Author Topic: Appdata  (Read 2337 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Appdata
« on: 22 April 2011, 06:16:51 »
Why make appdata the default directory (for windows) when even GAE uses the user directory (c:\users\YOUR_NAME). Appdata is a hidden folder, so fine if the files aren't meant to be touched, like cached files, autosaves, etc, but with Glest's modability, you'd expect that people should be able to find where to place their mods and such easily. Yet, appdata is a hidden folder, a concept that can confuse those without much computer experience (many people have no clue what a hidden folder even is, which, in a way, makes sense, as you don't normally see them and more often than not, they end up being something you shouldn't touch).

The way I see it, there's no advantages appdata has over using a separate folder (eg: "megaglest") in the user folder for windows (linux can stay as it is). Looking at most of my games, most of them (and all of the ones that are modable) use a folder in the user folder or documents folder instead of appdata, and looking at one example (Civ 4), it even provides multiple shortcuts to where specific types of mods (and other important files, like the settings file) are stored. I think this approach would be best for megaglest. I may sound like I'm ranting, but I simply am trying to look out for the new players, to whom glest and its large amount of customability is always daunting, and no need to make it more so by hiding the folder (how likely is someone who never played megaglest before and just downloaded and installed it, and is now looking for the settings file (the INI) likely to find the correct INI? Since the regular INI, which you now state should never be edited, is easier to find than the user INI...).

Don't most/all of the MegaGlest team use linux anyway?
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Appdata
« Reply #1 on: 22 April 2011, 07:01:19 »
A bit of research indicated this is the recommended best practice by Microsoft and numerous others, a few links:

http://blogs.msdn.com/b/patricka/archive/2010/03/18/where-should-i-store-my-data-and-configuration-files-if-i-target-multiple-os-versions.aspx
http://stackoverflow.com/questions/2614508/best-directory-to-store-application-data-with-read-write-rights-for-all-users

For best compatibiltiy for Windows XP -> Windows 7 using appdata is the safest thing to use to ensure you have a folder where all versions of windows can write to. With that said, the default path is easily changed, chances are if you know how to change the path then its likely safe to do so. Most windows users have no idea about finding folders (appdata or megaglest) and thus this is totally transparent to them. Installing mod's will be done via the mod's menu and yes more things will be added in there.

Anyways, this is just a quick 'rationale' behind the appdata, from all the research i did it was the most recommended.

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Appdata
« Reply #2 on: 22 April 2011, 11:50:48 »
As Softcoder implied, Windows XP doesn't have a 'Users' directory. There is 'Documents and Settings' but this is not to be used by applications to install data (other than example documents) to.

While Windows XP is in the extended support stage where only commercial support is available according to the plan, lots of netbooks were still sold with this operating system pre-installed mid last year (which was only possible because Microsoft extended its permission to sell specifically these devices with XP pre-installed until October 22, 2010) and as a result Microsoft is factually still providing end-user support for it (though very limited). Extended support for XP expires no earlier than April 8, 2014, so, while there will be further increased pressure by M$ to move to (and pay again for) Windows 7 until then, I predict that many people will continue using XP until the bitter end (and some even beyond, but those are lost cases).

What really matters for us, though, is not so much when official support ends etc. but rather what the real-world usage is. To date, the number of XP users on the web equals those of Windows Vista and 7 together. Until these statistics change remarkably, I guess we can't change defaults in a way that will cause errors for half the users of this (unfortunately) still most wide-spread operating system.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

workarounder

  • Guest
Re: Appdata
« Reply #3 on: 22 April 2011, 16:28:06 »
Maybe should take ability to choice to users in Configurator, where they would to store their game files?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Appdata
« Reply #4 on: 22 April 2011, 16:58:28 »
What if you do what Blender does and have the installer ask where to place the files? You can offer a few locations:
  • User folder (eg: c:\users\Your Name)
  • Documents folder (eg: c:\users\Your Name\Documents) - also compatible with XP, since while I can't recall how its folder structure works, it definitely has a "my documents" folder.
  • Appdata (eg: c:\users\Your Name\appdata) - current default
  • Installation directory (legacy location, for those who are the sole user of their computer and know exactly what they are doing)


Yes, I know you can change the setting in the INI, but if the user can't find the INI... Just something to consider.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

ultifd

  • Airship
  • ********
  • Posts: 4,443
  • The Glest Video Guy :) The one and only. :P
    • View Profile
    • My Youtube Channel
Re: Appdata
« Reply #5 on: 22 April 2011, 18:43:39 »
I'm pretty sure most people can find the ini, especially when you use the configurator it tells you where it's located...and you can even change it if you want.  :angel:

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Appdata
« Reply #6 on: 22 April 2011, 21:11:54 »
Fair enough, and the configurator fortunately has an option to change the directory, though I still wouldn't mind an installer variable.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Appdata
« Reply #7 on: 23 April 2011, 03:23:15 »
Wait what was so wrong with leaving the glestuser.ini in the original megaglest directory? It worked fine for me on both 32 bit xp and windows 7 64 bit. In order for me to create a standalone i have to put it back in megaglest directory anyway as i cant create app data directory through a zip file or 7z.
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Appdata
« Reply #8 on: 23 April 2011, 10:32:52 »
It's a matter of access restrictions and proper user separation on multi-user systems. As the name indicates, glestuser.ini is a file which is user specific.

So there should be a possibility to have multiple such files on a single operating system installation. If you have user A and user B who both login to this system then both should be able to have their own glestuser.ini. By storing this file in user specific %AppData% directory structure this becomes possible since this environment variable points to a different location depending on the username of the logged in user.

Storing these files there also allows for setting different permissions on the main MegaGlest files (which are installed to the %ProgramFiles% directory structure) and those user specific files. Once the installation is complete, the user specific files need still to be editable by the user, however the main MegaGlest files do not need to be. They can have different permissions set on them so that an ordinary user cannot change them (nor any malware which may be active in this users' session). However, this user can still install mods to his or her 'megaglest' directory within the %AppData% directory structure.

Those are old Unix principles which Linux has always been using (and Mac since, I think, it replaced 'Mac OS' by 'OS X') and Windows has introduced many years ago but is only enforcing as a standard lately, after realising that such fundamental flaws in the security design of an operating system can't sufficiently secure against the masses of malware attracted by the most wide-spread operating system.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Appdata
« Reply #9 on: 23 April 2011, 19:42:31 »
Indeed, I understand that, though would still like a choice in the installer.

Somewhat unrelatedly, it would be nice if MG detected your resolution so as to not force us to use a terrible 800x600 resolution (and thus messing up my nicely placed desktop icons once more) on the first run or when there is no user INI.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Appdata
« Reply #10 on: 23 April 2011, 21:51:08 »
It's a matter of access restrictions and proper user separation on multi-user systems. As the name indicates, glestuser.ini is a file which is user specific.

So there should be a possibility to have multiple such files on a single operating system installation. If you have user A and user B who both login to this system then both should be able to have their own glestuser.ini. By storing this file in user specific %AppData% directory structure this becomes possible since this environment variable points to a different location depending on the username of the logged in user.

Storing these files there also allows for setting different permissions on the main MegaGlest files (which are installed to the %ProgramFiles% directory structure) and those user specific files. Once the installation is complete, the user specific files need still to be editable by the user, however the main MegaGlest files do not need to be. They can have different permissions set on them so that an ordinary user cannot change them (nor any malware which may be active in this users' session). However, this user can still install mods to his or her 'megaglest' directory within the %AppData% directory structure.

Those are old Unix principles which Linux has always been using (and Mac since, I think, it replaced 'Mac OS' by 'OS X') and Windows has introduced many years ago but is only enforcing as a standard lately, after realising that such fundamental flaws in the security design of an operating system can't sufficiently secure against the masses of malware attracted by the most wide-spread operating system.

If i wanted to release this in a standalone mod how would i go about creating the app data directory?
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Appdata
« Reply #11 on: 23 April 2011, 22:56:25 »
Explain exactly what you want to do and we can try to point you in the right direction. Include the operating systems you are targeting.

Thanks

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Appdata
« Reply #12 on: 23 April 2011, 23:10:43 »
Ideally, you wouldn't create it. Just have the program files and the directory is automatically created when the program is run (assuming it doesn't already exist).
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert