aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r--Game/Code/Classes/TextGL.pas3
-rw-r--r--Game/Code/Classes/UMain.pas2
-rw-r--r--Game/Code/Classes/USongs.pas94
3 files changed, 51 insertions, 48 deletions
diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas
index aaee50a0..7475da7a 100644
--- a/Game/Code/Classes/TextGL.pas
+++ b/Game/Code/Classes/TextGL.pas
@@ -85,6 +85,9 @@ uses UMain,
{$IFDEF LAZARUS}
LResources,
{$ENDIF}
+ {$IFDEF DARWIN}
+ MacResources,
+ {$ENDIF}
UGraphic;
procedure BuildFont; // Build Our Bitmap Font
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index b1469f00..f25eaa87 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -1051,7 +1051,7 @@ procedure InitializePaths;
If DirectoryExists(aPathVar) then
begin
- lAttrib := fileGetAttr('C:Temp');
+ lAttrib := fileGetAttr(aPathVar);
lWriteable := ( lAttrib and faDirectory <> 0 ) AND
NOT ( lAttrib and faReadOnly <> 0 )
diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas
index 96d9ad2e..a04c1032 100644
--- a/Game/Code/Classes/USongs.pas
+++ b/Game/Code/Classes/USongs.pas
@@ -302,6 +302,7 @@ var
ADirent : pDirent;
Entry : Longint;
info : stat;
+ lAttrib : integer;
{$ENDIF}
begin
{$ifdef Delphi}
@@ -410,62 +411,61 @@ begin
{$IFDEF DARWIN}
// Itterate the Songs Directory... ( With unicode capable functions for linux )
- TheDir := FPOpenDir( Dir ); // JB_Unicode - linux
+ TheDir := FPOpenDir(Dir); // JB_Unicode - linux
if TheDir <> nil then
begin
repeat
ADirent := FPReadDir(TheDir);
- If ADirent<>Nil then
+ If assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then
begin
- With ADirent^ do
- begin
-
- if ( d_name[0] <> '.') then
- BrowseDir( Dir + d_name + pathdelim );
-
- end;
+ lAttrib := FileGetAttr(Dir + ADirent^.d_name);
+ if (lAttrib and faDirectory) <> 0 then
+ begin
+ //Log.LogError('Entering dir "' + Dir + ADirent^.d_name + PathDelim + '" now.');
+ BrowseDir(Dir + ADirent^.d_name + PathDelim);
+ end
+ else if Pos( '.txt', LowerCase(ADirent^.d_name)) > 0 then
+ begin
+ SLen := BrowsePos;
+
+ try
+ Song[SLen].Path := Dir;
+ Song[SLen].Folder := Copy(String(Dir), Length(String(SongPath))+1, 10000);
+ Song[SLen].Folder := Copy(String(Song[SLen].Folder), 1, Pos( PathDelim , Song[SLen].Folder)-1);
+ Song[SLen].FileName := ADirent^.d_name;
+ //Log.LogError( 'Song: ' + ADirent^.d_name + ', Length(Song) = ' + inttostr(Length(Song)) + ', BrowsePos = ' + IntToStr(BrowsePos) + ', Dir = "' + Dir + '"');
+
+ if (AnalyseFile(Song[SLen]) = false) then
+ begin
+ Log.LogError('AnalyseFile failed for "' + ADirent^.d_name + '".');
+ Dec(BrowsePos);
+ end
+ else
+ begin
+ if Song[SLen].Cover = '' then
+ Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg');
+ end;
+ except
+ 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;
end;
+
Until ADirent=Nil;
+
+ if (FPCloseDir(TheDir) <> 0) then
+ begin
+ Log.LogError('TSongs.BrowseDir: Exception: Error closing dir: "' + Dir + '".')
+ end;
end;
-
-
-
- TheDir := FPOpenDir( Dir ); // JB_Unicode - linux
- if TheDir <> nil then
- begin
- repeat
- ADirent := FPReadDir(TheDir);
-
- if ( ADirent <> Nil ) AND
- ( pos( '.txt', ADirent^.d_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^.d_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;
-
- Until ADirent=Nil;
- end; // if FindFirst
{$endif}