From 5195c37d8b7ec4a9c98b893725026d10a5e21983 Mon Sep 17 00:00:00 2001 From: Jan Vansteenkiste Date: Mon, 24 Jun 2019 10:09:05 +0200 Subject: [PATCH] Better save file handling By using the plugin_dir, we always save in the plugin's folder. This is useful when the plugin folder has another name (for example: EDMC_SpanshRouter) and works cross platform. --- load.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/load.py b/load.py index 925be39..762a5f0 100644 --- a/load.py +++ b/load.py @@ -18,12 +18,8 @@ this.parent = None this.save_route_path = "" -def plugin_start(): - if sys.platform == 'win32': - this.save_route_path = os.path.expandvars(r'%LOCALAPPDATA%\EDMarketConnector\plugins\SpanshRouter\route.csv') - else: - home = os.path.expanduser("~") - this.save_route_path = home + "/.local/share/EDMarketConnector/plugins/SpanshRouter/route.csv" +def plugin_start(plugin_dir): + this.save_route_path = os.path.join(plugin_dir, 'route.csv') try: # Open the last saved route