diff options
author | jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-10-29 23:09:04 +0000 |
---|---|---|
committer | jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-10-29 23:09:04 +0000 |
commit | 2fdee21c44d16fa2a521380672f8868565bb4df5 (patch) | |
tree | 911bb163a54e3cdb37aa710e547038b1b1d224d7 /Game/Code/Classes | |
parent | 58cbbe9ff83221360f2444bb07630b1c0dda3739 (diff) | |
download | usdx-2fdee21c44d16fa2a521380672f8868565bb4df5.tar.gz usdx-2fdee21c44d16fa2a521380672f8868565bb4df5.tar.xz usdx-2fdee21c44d16fa2a521380672f8868565bb4df5.zip |
fixed build error since build#USDX-LAZLIN-65
doh :(
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@542 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r-- | Game/Code/Classes/USongs.pas | 111 |
1 files changed, 77 insertions, 34 deletions
diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index e3c54ac4..5ce35201 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -134,14 +134,15 @@ end; procedure TSongs.BrowseDir(Dir: widestring); var - SR: TSearchRecW; // for parsing Songs Directory SLen: integer; - {$ifndef win32} - TheDir : pdir; - ADirent :pDirent; - Entry : Longint; - info : stat; + {$ifdef win32} + SR: TSearchRecW; // for parsing Songs Directory + {$else} // This should work on all posix systems. + TheDir : pdir; + ADirent : pDirent; + Entry : Longint; + info : stat; {$endif} begin {$ifdef win32} @@ -155,6 +156,37 @@ begin until FindNextw(SR) <> 0; end; // if FindClosew(SR); + + if FindFirstW(Dir + '*.txt', 0, SR) = 0 then + begin + repeat + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := SR.Name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + + until FindNextW(SR) <> 0; + end; // if FindFirst + FindCloseW(SR); + {$else} // Itterate the Songs Directory... ( With unicode capable functions for linux ) TheDir := opendir( Dir ); // JB_Unicode - linux @@ -175,39 +207,50 @@ begin end; Until ADirent=Nil; end; - {$endif} - -// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); + + - if FindFirstW(Dir + '*.txt', 0, SR) = 0 then - begin - repeat - SLen := BrowsePos; + TheDir := opendir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := ReadDir(TheDir); + + if ( ADirent <> Nil ) AND + ( pos( '.txt', ADirent^.name ) > -1 ) then + begin + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := ADirent^.name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + end; - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := SR.Name; + Until ADirent=Nil; + end; // if FindFirst - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; + {$endif} + +// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - until FindNextW(SR) <> 0; - end; // if FindFirst - FindCloseW(SR); end; procedure TSongs.Sort(Order: integer); |