Skip to content

Commit ee87367

Browse files
author
lachlan-00
committed
Add fallback master config if OS/Platform check fails and exten OS checks
1 parent 7195950 commit ee87367

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

classifier/classifier.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
VERSION = 'Classifier 1.99dev'
2121
DIRCONFFILE = '.classifier.conf'
2222
PLATFORM = sys.platform
23+
OS = os.name
24+
2325
if PLATFORM == 'darwin':
2426
CONFIG = os.path.join(os.path.expanduser('~'), '.classifier-master.conf')
25-
elif PLATFORM == 'nt':
27+
elif PLATFORM == 'win32' or OS == 'nt':
2628
CONFIG = os.path.join(os.getenv('userprofile'), 'classifier-master.conf')
27-
elif PLATFORM == 'linux':
29+
elif PLATFORM == 'linux' or PLATFORM == 'linux2' or OS == 'posix':
2830
CONFIG = os.path.join(os.getenv('HOME'), '.classifier-master.conf')
31+
else:
32+
CONFIG = os.path.join(os.getcwd(), '.classifier-master.conf')
2933

3034

3135
def main():
@@ -168,6 +172,7 @@ def classify_by_date(self, date_format, output, directory):
168172
return
169173

170174
def _format_text_arg(self, arg):
175+
""" Set a date format to name your folders"""
171176
if not isinstance(arg, str):
172177
arg = arg.decode('utf-8')
173178
return arg
@@ -190,9 +195,9 @@ def run(self):
190195
if self.args.edittypes:
191196
if PLATFORM == 'darwin':
192197
subprocess.call(('open', CONFIG))
193-
elif PLATFORM == 'nt':
198+
elif PLATFORM == 'win32' or OS == 'nt':
194199
os.startfile(CONFIG)
195-
elif PLATFORM == 'linux':
200+
elif PLATFORM == 'linux' or PLATFORM == 'linux2' or OS == 'posix'
196201
subprocess.Popen(['xdg-open', CONFIG])
197202
return False
198203
if bool(self.args.specific_folder) ^ bool(self.args.specific_types):

0 commit comments

Comments
 (0)