The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: darkbill on July 06, 2012, 07:36:51 PM

Title: Should main and personal dir be renamed in Linux Version?
Post by: darkbill on July 06, 2012, 07:36:51 PM
1, For Simutrans, it sets the main directory at /usr/share/game/simutrans, and saves personal files at ~/.simutrans. Location ~/ means the personal home directory.
2, For Simutrans-Experimental, it also sets the main directory at  /usr/share/game/simutrans, same as Simutrans, and saves personal files at ~/simutrans, just small changes between Simutrans -- without the little point, so this directory is not hidden.

Therefore, if someone like me would like to install both versions to play and enjoy game fun for different settings in both versions, he will get into trouble.
And for the personal saving directory, it should be better to change the directory name and hide it. (Many Linux software save personal config file under user's home directory and hide it.)

So my suggestion is changing the main directory /usr/share/game/simutrans into /usr/share/game/simutrans-experiment, and also changing personal directory from ~/simutrans to ~/.simutrans-experiment

Does somebody know how to?
Thanks very much.
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: darkbill on July 06, 2012, 08:08:18 PM
For the main directory, if actually need to relocate, just change /usr/share/games/simutrans/ into /usr/share/games/simutrans-experimental/
in source file simmain.cc.

But what about if I need to change the savegame path?
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: kierongreen on July 06, 2012, 08:17:36 PM
This debian patch may help:
--- simutrans.orig/simsys.cc
+++ simutrans/simsys.cc
@@ -39,7 +39,7 @@
#elif defined __APPLE__
   sprintf(buffer, "%s/Library/Simutrans", getenv("HOME"));
#else
-   sprintf(buffer, "%s/simutrans", getenv("HOME"));
+   sprintf(buffer, "%s/.simutrans", getenv("HOME"));
#endif

   dr_mkdir(buffer);
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: darkbill on July 07, 2012, 02:17:27 AM
Quote from: kierongreen on July 06, 2012, 08:17:36 PM
This debian patch may help:
--- simutrans.orig/simsys.cc
+++ simutrans/simsys.cc
@@ -39,7 +39,7 @@
#elif defined __APPLE__
   sprintf(buffer, "%s/Library/Simutrans", getenv("HOME"));
#else
-   sprintf(buffer, "%s/simutrans", getenv("HOME"));
+   sprintf(buffer, "%s/.simutrans", getenv("HOME"));
#endif

   dr_mkdir(buffer);

Thanks very much. I get it.
So should them be renamed or not?

If should, I make a patch as below:

diff --git a/simmain.cc b/simmain.cc
--- a/simmain.cc
+++ b/simmain.cc
@@ -476,7 +476,7 @@ int simu_main(int argc, char** argv)
      // data files are in /usr/share/games/simutrans
         char backup_program_dir[1024];
      strcpy(backup_program_dir, umgebung_t::program_dir);
-      strcpy( umgebung_t::program_dir, "/usr/share/games/simutrans/" );
+      strcpy( umgebung_t::program_dir, "/usr/share/games/simutrans-experimental/" );
         chdir( umgebung_t::program_dir );
      if(simuconf.open("config/simuconf.tab"))
      {
@@ -536,7 +536,7 @@ int simu_main(int argc, char** argv)
      // Again, attempt to use the Debian directory.
      char backup_program_dir[1024];
      strcpy(backup_program_dir, umgebung_t::program_dir);
-      strcpy( umgebung_t::program_dir, "/usr/share/games/simutrans/" );
+      strcpy( umgebung_t::program_dir, "/usr/share/games/simutrans-experimental/" );
         chdir( umgebung_t::program_dir );
      xml_settings_found = file.rd_open(xml_filename);
      if(!xml_settings_found)

diff --git a/simsys.cc b/simsys.cc
--- a/simsys.cc
+++ b/simsys.cc
@@ -47,7 +47,7 @@ char const* dr_query_homedir()
#elif defined __APPLE__
   sprintf(buffer, "%s/Library/Simutrans", getenv("HOME"));
#else
-   sprintf(buffer, "%s/simutrans", getenv("HOME"));
+   sprintf(buffer, "%s/.simutrans-experimental", getenv("HOME"));
#endif

   dr_mkdir(buffer);
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: kierongreen on July 07, 2012, 08:38:03 AM
Seems a good idea to me, but I don't develop simutrans-experimental :)
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: darkbill on July 07, 2012, 09:07:00 AM
Neither am I.
I am just a normal Linux user. :)
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: jamespetts on July 07, 2012, 11:26:10 AM
Thank you both for those suggestions - they are now incorporated in -devel, with the small change that I have used "simutrans-ex" rather than "simutrans-experimental", as I plan eventually to change the name to "simutrans-extended" when the branch is more stable.
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: darkbill on July 07, 2012, 05:29:19 PM
Thank you, James.
I will check out later. And I like the new name.

BTW, I think we need to write more detail information for Linux users to compile in Readme file. I will try to do it and give feedbacks in days.
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: jamespetts on July 07, 2012, 05:30:46 PM
Darkbill,

if you could improve the readme file, that would be very helpful - thank you!
Title: Re: Should main and personal dir be renamed in Linux Version?
Post by: Vonjo on July 08, 2012, 02:51:52 PM
Quote from: jamespetts on July 07, 2012, 11:26:10 AM
Thank you both for those suggestions - they are now incorporated in -devel, with the small change that I have used "simutrans-ex" rather than "simutrans-experimental", as I plan eventually to change the name to "simutrans-extended" when the branch is more stable.
Nice new name. :D

Thanks for fixing the directory. I have tested it. It works fine so far. :)