I am making a jython application that needs a configuration / settings file (and possibly the final directory), but I want it to be stored in the expected / correct directory for each os.
~ / .app_name / config on linux
c: / documents and Settings / User / app_name ?? in the windows.
I found this:
http://snipplr.com/view/7354/home-directory-crossos/
but this is for python, and I feel that it may not need to work for jython / windows, and I don't have any dev files created in my Windows VM for testing at the moment
If anyone can give any idea of ββthe "best practices" (for jython) to achieve this, I would really appreciate it.
Thanks.
EDIT:
Here is what I came up with that seems to work ... I would appreciate any feedback
import os
from java.lang import System
from java.io import File
os_name = System.getProperty('os.name')
os_sep = File.separator
app_name = 'ctrlmac'
if os_name == 'Windows':
config_dir = os.environ["APPDATA"] + os_sep + app_name
else:
config_dir = os.path.expanduser("~") + os_sep + '.' + app_name
print config_dir