1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
diff --git a/hydrus/client/gui/ClientGUI.py b/hydrus/client/gui/ClientGUI.py
index db9fd6f..c925431 100644
--- a/hydrus/client/gui/ClientGUI.py
+++ b/hydrus/client/gui/ClientGUI.py
@@ -792,7 +792,7 @@ class FrameGUI( ClientGUITopLevelWindows.MainFrameThatResizes ):
python_executable = python_executable.replace( 'pythonw', 'python' )
- server_script_path = os.path.join( HC.BASE_DIR, 'server.py' )
+ server_script_path = '/opt/hydrus/server.py'
cmd = [ python_executable, server_script_path, db_param ]
diff --git a/hydrus/client/gui/ClientGUIStyle.py b/hydrus/client/gui/ClientGUIStyle.py
index 7de8ef2..1196c62 100644
--- a/hydrus/client/gui/ClientGUIStyle.py
+++ b/hydrus/client/gui/ClientGUIStyle.py
@@ -6,7 +6,7 @@ from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
-STYLESHEET_DIR = os.path.join( HC.BASE_DIR, 'static', 'qss' )
+STYLESHEET_DIR = os.path.join( HC.STATIC_DIR, 'qss' )
DEFAULT_HYDRUS_STYLESHEET = ''
ORIGINAL_STYLE_NAME = None
diff --git a/hydrus/core/HydrusConstants.py b/hydrus/core/HydrusConstants.py
index 857715d..ff6a7ae 100644
--- a/hydrus/core/HydrusConstants.py
+++ b/hydrus/core/HydrusConstants.py
@@ -5,33 +5,9 @@ import typing
# old method of getting frozen dir, doesn't work for symlinks looks like:
# BASE_DIR = getattr( sys, '_MEIPASS', None )
-RUNNING_FROM_FROZEN_BUILD = getattr( sys, 'frozen', False )
-
-if RUNNING_FROM_FROZEN_BUILD:
-
- real_exe_path = os.path.realpath( sys.executable )
-
- BASE_DIR = os.path.dirname( real_exe_path )
-
-else:
-
- try:
-
- hc_realpath_dir = os.path.dirname( os.path.realpath( __file__ ) )
-
- HYDRUS_MODULE_DIR = os.path.split( hc_realpath_dir )[0]
-
- BASE_DIR = os.path.split( HYDRUS_MODULE_DIR )[0]
-
- except NameError: # if __file__ is not defined due to some weird OS
-
- BASE_DIR = os.path.realpath( sys.path[0] )
-
-
- if BASE_DIR == '':
-
- BASE_DIR = os.getcwd()
-
+RUNNING_FROM_FROZEN_BUILD = False
+HYDRUS_MODULE_DIR = '/opt/hydrus/hydrus'
+BASE_DIR = os.path.expanduser("~/.local/share/hydrus")
PLATFORM_WINDOWS = sys.platform == 'win32'
PLATFORM_MACOS = sys.platform == 'darwin'
@@ -41,23 +17,16 @@ PLATFORM_HAIKU = sys.platform == 'haiku1'
RUNNING_FROM_SOURCE = sys.argv[0].endswith( '.py' ) or sys.argv[0].endswith( '.pyw' )
RUNNING_FROM_MACOS_APP = os.path.exists( os.path.join( BASE_DIR, 'running_from_app' ) )
-BIN_DIR = os.path.join( BASE_DIR, 'bin' )
-HELP_DIR = os.path.join( BASE_DIR, 'help' )
-INCLUDE_DIR = os.path.join( BASE_DIR, 'include' )
-STATIC_DIR = os.path.join( BASE_DIR, 'static' )
+BIN_DIR = "/opt/hydrus/bin"
+HELP_DIR = "/opt/hydrus/help"
+INCLUDE_DIR = "/opt/hydrus/include"
+STATIC_DIR = "/opt/hydrus/static"
DEFAULT_DB_DIR = os.path.join( BASE_DIR, 'db' )
-if PLATFORM_MACOS:
-
- USERPATH_DB_DIR = os.path.join( os.path.expanduser( '~' ), 'Library', 'Hydrus' )
-
-else:
-
- USERPATH_DB_DIR = os.path.join( os.path.expanduser( '~' ), 'Hydrus' )
-
+USERPATH_DB_DIR = DEFAULT_DB_DIR
-LICENSE_PATH = os.path.join( BASE_DIR, 'license.txt' )
+LICENSE_PATH = "/usr/share/licenses/hydrus/license.txt"
#
|