aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UMain.pas
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-12 12:43:38 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-12 12:43:38 +0000
commit6e7b96ca3a7d47b0441bed904a9b8bb25c3223de (patch)
tree2c0fa5010e7e8c37000d7fdd52d9e919e3f0555a /Game/Code/Classes/UMain.pas
parent08ad90ec9f574c7dc153c8d40169f3a58c9beb9a (diff)
downloadusdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.tar.gz
usdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.tar.xz
usdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.zip
* added missed dependency PNGImage.
* moved FUNCTION InitializePaths(), from uFiles to uMain as this is a more sane location for it. * updated files that used UFiles to point to UMain, and removed uFiles where its not needed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@385 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UMain.pas')
-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.