diff --git a/horsy.py b/horsy.py index 84220bd..0faab2e 100644 --- a/horsy.py +++ b/horsy.py @@ -54,7 +54,8 @@ try: os.system('horsy_updater.exe horsy') sys.exit(0) except: - print('Horsy may be not installed correctly. Please reinstall it.') + print('Horsy may be not installed correctly. Please reinstall it or stop other horsy instances. ' + 'If you installed it just now, please restart PC.') isNoArgs = False diff --git a/horsygui.py b/horsygui.py index 9623e6e..cf4fc49 100644 --- a/horsygui.py +++ b/horsygui.py @@ -221,11 +221,19 @@ def gui_package_edit(): # Run functions on startup if __name__ == "__main__": + # Checking directories and files + if not os.path.exists(horsy_vars.horsypath + 'apps'): + os.makedirs(horsy_vars.horsypath + 'apps') + if not os.path.isfile(horsy_vars.horsypath + 'config.cfg'): + with open(horsy_vars.horsypath + 'config.cfg', 'w') as f: + f.write('{}') + # Checking version try: f = open(horsy_vars.horsypath + 'apps/version', 'r') except: - gui.popup('Error', 'Horsy may be not installed correctly. Please reinstall it.') + gui.popup('Error', 'Horsy may be not installed correctly. Please reinstall it or stop another instances if ' + 'running. If you installed it just now, please restart PC.') version = int(f.read()) if int(requests.get('https://github.com/horsy-ml/horsy/raw/master/web_vars/version').text) > version: gui.popup('Update', 'New version available! \nWe appreciate your safety, so you need to update horsy.' diff --git a/modules/gui_manager.py b/modules/gui_manager.py index 06e4e56..ba02f99 100644 --- a/modules/gui_manager.py +++ b/modules/gui_manager.py @@ -123,7 +123,7 @@ def install(package): with open('{1}apps/{0}.bat'.format(r['name'], horsy_vars.horsypath), 'w') as f: f.write(f"@ECHO off\n") - f.write(f"{horsy_vars.horsypath[0:2:1]}\n") + f.write(f"%horsypath:~0,1%:\n") f.write(f"cd %horsypath%/apps/{r['name']}\n") f.write(f"{r['run']} %*\n") diff --git a/modules/manager.py b/modules/manager.py index fff5d17..6fbf096 100644 --- a/modules/manager.py +++ b/modules/manager.py @@ -114,7 +114,7 @@ def install(package): with open('{1}apps/{0}.bat'.format(r['name'], horsy_vars.horsypath), 'w') as f: f.write(f"@ECHO off\n") - f.write(f"{horsy_vars.horsypath[0:2:1]}\n") + f.write(f"%horsypath:~0,1%:\n") f.write(f"cd %horsypath%/apps/{r['name']}\n") f.write(f"{r['run']} %*\n")