blob: 35134bd5fefc9ca487e996703d4e8bd9b2a2cd06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
program libfatdir;
uses
ctypes, nds9, fat;
var
MyDir: PDir;
pent: pdirent;
statbuf: Tstat;
begin
// Initialise the console, required for printf
consoleDemoInit();
if (fatInitDefault()) then
begin
MyDir := opendir('/');
if (MyDir) <> nil then
begin
repeat
pent := readdir(MyDir);
_stat(pent^.d_name, statbuf);
if (strcmp('.', pent^.d_name) = 0) or (strcmp('..', pent^.d_name) = 0) then
continue;
if (S_ISDIR(statbuf.st_mode)) then
iprintf('%s <dir>'#10, pent^.d_name);
if not (S_ISDIR(statbuf.st_mode)) then
iprintf('%s %ld'#10, pent^.d_name, statbuf.st_size);
until pent = nil;
closedir(MyDir);
end else
begin
iprintf ('opendir() failure; terminating'#10);
end;
end else
begin
iprintf('fatInitDefault failure: terminating'#10);
end;
while true do
begin
swiWaitForVBlank();
scanKeys();
if (keysDown() and KEY_START) <> 0 then break;
end;
end.
|