News:

Want to praise Simutrans?
Your feedback is important for us ;D.

Should main and personal dir be renamed in Linux Version?

Started by darkbill, July 06, 2012, 07:36:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

darkbill

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.

darkbill

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?

kierongreen

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);

darkbill

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);

kierongreen

Seems a good idea to me, but I don't develop simutrans-experimental :)

darkbill


jamespetts

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

darkbill

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.

jamespetts

Darkbill,

if you could improve the readme file, that would be very helpful - thank you!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Vonjo

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. :)