2a3fa46493322059bd95ae78aec333836b43f818
2 from sys
import platform
, argv
3 from logging
import info
4 from os
.path
import exists
5 from os
import makedirs
6 from panda3d
.core
import Filename
, load_prc_file_data
7 from direct
.showbase
.ShowBase
import ShowBase
14 self
.base
= ShowBase()
15 info('platform: %s' % platform
)
16 info('exists main.py: %s' % exists('main.py'))
17 self
._prepare
_windows
()
18 args
= self
._parse
_args
()
19 self
.updating
= args
.update
20 self
.version
= args
.version
25 load_prc_file_data('', 'window-title pmachines')
27 def _parse_args(self
):
28 parser
= argparse
.ArgumentParser()
29 parser
.add_argument('--update', action
='store_true')
30 parser
.add_argument('--version', action
='store_true')
31 cmd_line
= [arg
for arg
in iter(argv
[1:]) if not arg
.startswith('-psn_')]
32 args
= parser
.parse_args(cmd_line
)
35 def _prepare_windows(self
):
37 if (platform
.startswith('win') or platform
.startswith('linux')) and (
38 not exists('main.py') or __file__
.startswith('/app/bin/')):
39 # it is the deployed version for windows
40 data_path
= str(Filename
.get_user_appdata_directory()) + '/pmachines'
41 home
= '/home/flavio' # we must force this for wine
42 if data_path
.startswith('/c/users/') and exists(home
+ '/.wine/'):
43 data_path
= home
+ '/.wine/drive_' + data_path
[1:]
44 info('creating dirs: %s' % data_path
)
45 makedirs(data_path
, exist_ok
=True)