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

Support for XDG Base Directory Specification #561

Merged
merged 7 commits into from Feb 10, 2015

Conversation

bschramke
Copy link
Contributor

Made some little changes, that makes it easy to stick to XDG Base Directory Specification.

On Linux its not a good idea to save configuration files beside the application's executable, because of executables normally located in '/usr/bin'. Also it's no good idea to clutter the users home directory with application specific data.

New methods:

  • Poco::Path::configHome() => Unix('/.config/'), OSX('/Library/Preferences/'), Win('%APPDATA%'), VxWorks & Other(invokes homeImpl)
  • Poco::Path::dataHome() => Unix('/.local/share/'), OSX('/Library/Application Support/'), Win('%LOCALAPPDATA%'), VxWorks & Other(invokes homeImpl)
  • Poco::Path::cacheHome() => Unix('/.cache/'), OSX('/Library/Caches/'), Win('%TEMP%'), VxWorks & Other(invokes tempImpl)
  • Poco::Path::tempHome() => Unix('/.local/tmp/'), OSX('/Library/Caches/'), Win('%TEMP%'), VxWorks & Other(invokes tempImpl)
  • Poco::Path::config() => Unix('/etc/'), OSX('/Library/Preferences/'), Win('%PROGRAMDATA%'), Other(invokes currentImpl)

New configuration values:

  • system.configHomeDir => Path::configHome()
  • system.cacheHomeDir => Path::cacheHome()
  • system.dataHomeDir => Path::dataHome()
  • system.tempHomeDir => Path::tempHome()
  • system.configDir => Path::config()
  • application.configDir => Path::configHome() + application.baseName
  • application.cacheDir => Path::cacheHome() + application.baseName
  • application.dataDir => Path::dataHome() + application.baseName
  • application.tempDir => Path::tempHome() + application.baseName

EDIT: add OSX compliant implementation
EDIT: add Windows compliant implementation

@bakercp
Copy link
Member

bakercp commented Oct 9, 2014

This is interesting -- would it be possible to have a OSX-style implementation along these lines?

https://stackoverflow.com/questions/3373948/equivalents-of-xdg-config-home-and-xdg-data-home-on-mac-os-x

@bschramke
Copy link
Contributor Author

@bakercp sure, this would be no problem. but i'm not familiar with the special needs on OSX. Taking account of the information from your link, I would recommend the following mapping:

  • Poco::Path::configHome() => ~/Library/Preferences/
  • Poco::Path::dataHome() => ~/Library/Application Support/
  • Poco::Path::cacheHome() => ~/Library/Caches/
  • Poco::Path::tempHome() => ~/Library/Caches/
  • Poco::Path::config() => /Library/Preferences/

But for the sake of completeness there should also be implemented a support for plist-configurations.

@obiltschnig
Copy link
Member

Can we also have meaningful Windows implementations of these functions?

@bschramke
Copy link
Contributor Author

i think windows implementations are also no problem. According to http://windows.microsoft.com/de-de/windows-8/what-appdata-folder and http://de.wikipedia.org/wiki/Umgebungsvariable the following mapping should be meaningful

  • Poco::Path::configHome() => %APPDATA%
  • Poco::Path::dataHome() => %LOCALAPPDATA%
  • Poco::Path::cacheHome() => %TEMP%
  • Poco::Path::tempHome() => %TEMP%
  • Poco::Path::config() => %PROGRAMDATA%

@aleks-f
Copy link
Member

aleks-f commented Jan 1, 2015

So @bschramke @obiltschnig @bakercp , is this good to be merged or does it require more work on various platforms?

@obiltschnig
Copy link
Member

We should have meaningful Windows and OS X implementations before we merge this.

@bschramke
Copy link
Contributor Author

I'm not sure if they are meaningful, but implementations for OSX and Windows are already there. I've tested the Linux and Windows implementations on openSUSE 13.1 and Windows 8, and they work fine. The mappings on Win and OSX maybe need some fine adjustment, especially the fallback mappings on Windows, but on the whole i think it's ready.

@aleks-f
Copy link
Member

aleks-f commented Jan 26, 2015

@obiltschnig any further comments or is it good to go?

@obiltschnig
Copy link
Member

OK, looked at it again. Looks like everything's there already. The class documentation for SystemConfiguration should be updated to include the new properties.

@aleks-f
Copy link
Member

aleks-f commented Jan 28, 2015

Ok, great. This should go in 1.7.0; I'll fork off 1.6.1 and merge this into develop if there are no more objections.

aleks-f added a commit that referenced this pull request Feb 10, 2015
Support for XDG Base Directory Specification
@aleks-f aleks-f merged commit c00f13d into pocoproject:develop Feb 10, 2015
@aleks-f aleks-f added this to the Release 1.8.2 milestone Feb 13, 2018
@obiltschnig obiltschnig added this to the Release 1.10.0 milestone Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants