aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UMain.pas
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UMain.pas51
1 files changed, 51 insertions, 0 deletions
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index 98e1acb4..43010bde 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -70,6 +70,18 @@ type
var
+ //Absolute Paths
+ GamePath: string;
+ SoundPath: string;
+ SongPath: string;
+ LogPath: string;
+ ThemePath: string;
+ ScreenshotsPath: string;
+ CoversPath: string;
+ LanguagesPath: string;
+ PluginPath: string;
+ PlayListPath: string;
+
OGL: Boolean;
Done: Boolean;
Event: TSDL_event;
@@ -80,6 +92,7 @@ var
Player: array of TPlayer;
PlayersPlay: integer;
+procedure InitializePaths;
procedure MainLoop;
procedure CheckEvents;
@@ -706,9 +719,47 @@ begin
Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500;
Player[PlayerNum].LineBonus_TargetY := 30;
//PhrasenBonus - Line Bonus Mod End
+end;
+
+//--------------------
+// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist
+//--------------------
+procedure InitializePaths;
+
+ // Initialize a Path Variable
+ // After Setting Paths, make sure that Paths exist
+ function initialize_path( out aPathVar : String; const aLocation : String ): boolean;
+ var
+ lWriteable: Boolean;
+ begin
+ aPathVar := aLocation;
+
+ If DirectoryExists(aPathVar) then
+ lWriteable := ForceDirectories(aPathVar)
+ else
+ lWriteable := false;
+
+ if not lWriteable then
+ Log.LogError('Error: Dir ('+ aLocation +') is Readonly');
+
+ result := lWriteable;
+ end;
+
+begin
+ GamePath := ExtractFilePath(ParamStr(0));
+ initialize_path( LogPath , GamePath );
+ initialize_path( SoundPath , GamePath + 'Sounds\' );
+ initialize_path( SongPath , GamePath + 'Songs\' );
+ initialize_path( ThemePath , GamePath + 'Themes\' );
+ initialize_path( ScreenshotsPath , GamePath + 'Screenshots\');
+ initialize_path( CoversPath , GamePath + 'Covers\' );
+ initialize_path( LanguagesPath , GamePath + 'Languages\' );
+ initialize_path( PluginPath , GamePath + 'Plugins\' );
+ initialize_path( PlaylistPath , GamePath + 'Playlists\' );
+ DecimalSeparator := ',';
end;
end.