Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate the unixpaths patch from Debian #49

Open
o11c opened this issue Nov 23, 2016 · 2 comments
Open

Integrate the unixpaths patch from Debian #49

o11c opened this issue Nov 23, 2016 · 2 comments

Comments

@o11c
Copy link

o11c commented Nov 23, 2016

The config bits should probably be excluded, since GetAppConfigDir() should
do the right thing anyway (actually better, since the Debian patch doesn't
follow the XDG standards).

Assuming the keybinding-incompatibility problem is fixed, the application
name should probably be forced to "gearhead" even if the executable is named
"gearhead-sdl".

For development purposes, it should probably use a fallback scheme: command-line arguments (if passed) -> current directory (if Series/ exists?) -> DATADIR/PACKAGE (usual case)

Also, please implement --help! I appears to try to open a file by that name, but it's unclear what it does.

Index: gearhead-1.300/arenascript.pp
===================================================================
--- gearhead-1.300.orig/arenascript.pp	2016-04-06 22:29:01.953334654 +0300
+++ gearhead-1.300/arenascript.pp	2016-04-06 22:30:10.602876343 +0300
@@ -37,9 +37,9 @@
 interface
 
 {$IFDEF SDLMODE}
-uses gears,locale,sdlmenus,sdl,sdlgfx;
+uses dos,gears,locale,sdlmenus,sdl,sdlgfx;
 {$ELSE}
-uses gears,locale,conmenus;
+uses dos,gears,locale,conmenus;
 {$ENDIF}
 
 const
@@ -1498,7 +1498,7 @@
 		PC := PC^.Next;
 	end;
 
-	SaveStringList( Config_Directory + FName + '.txt' , VList );
+	SaveStringList( GetEnv( 'HOME' ) + '/.gearhead/' + FName + '.txt' , VList );
     {$IFDEF SDLMODE}
     ASRD_GameBoard := GB;
     MoreText( VList, 1 , @ArenaScriptRedraw );
Index: gearhead-1.300/ui4gh.pp
===================================================================
--- gearhead-1.300.orig/ui4gh.pp	2016-04-06 22:29:01.953334654 +0300
+++ gearhead-1.300/ui4gh.pp	2016-04-06 22:29:01.945334475 +0300
@@ -343,7 +343,7 @@
 		T: Integer;
 	begin
 		{See whether or not there's a configuration file.}
-		S := FSearch(Config_File,'.');
+		S := FSearch(Config_File,GetEnv('HOME')+'/.gearhead/;/etc');
 		if S <> '' then begin
 			{ If we've found a configuration file, }
 			{ open it up and start reading. }
Index: gearhead-1.300/gears.pp
===================================================================
--- gearhead-1.300.orig/gears.pp	2016-04-06 22:29:01.953334654 +0300
+++ gearhead-1.300/gears.pp	2016-04-06 22:31:52.801168392 +0300
@@ -1273,16 +1273,17 @@
 
 initialization
 	{ Make sure we have the required data directories. }
+	ChDir( '/usr/share/games/gearhead' );
     if paramcount() > 0 then begin
         Config_Directory := IncludeTrailingPathDelimiter( paramstr(1) );
     end else begin
     {$IFDEF WINDOWS}
         Config_Directory := GetUserDir() + OS_Dir_Separator + 'gharena' + OS_Dir_Separator;
     {$ELSE}
-        Config_Directory := GetAppConfigDir(False);
+        Config_Directory := GetEnv( 'HOME' ) + '/.gearhead/';

     {$ENDIF}
     end;
-	Config_File := Config_Directory + 'gharena.cfg';
+	Config_File := Config_Directory + 'gearhead.conf';
 
 	Save_Game_DirName := 'SaveGame';
 	Save_Game_Directory := Config_Directory + Save_Game_Dirname + OS_Dir_Separator;
@kaol
Copy link

kaol commented Nov 27, 2016

I had already asked jwvhewitt to look through the Debian patches when he revived Gearhead development and he incorporated the rest of the patches that it had accumulated during the years but we agreed to let aside the unixpaths one. The way I did it is too specific for Debian and it relies on having the data files in a certain directory, which is ensured by the Debian build scripts and package management and Gearhead has none of that. It's not suitable for merging in its current form.

See #3

@o11c
Copy link
Author

o11c commented Nov 27, 2016

and Gearhead has none of that.

had none of that. I've started by submitting #53, along with filing other build-system-related issues (I really wish I could add labels to everything I've filed, but that's only possible for people with write access to the repo).

I haven't actually added a -d flag to pass the directory from the makefile down though, but there are other issues with the unixpaths patch in its current form (e.g. the config file being regressive - not using XDG - which in turn requires setting the application name explicitly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants