diff --git a/FlatCAMApp.py b/FlatCAMApp.py index e8729a07..431682c4 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -101,9 +101,6 @@ class App(QtCore.QObject): version = 8.94 version_date = "2019/08/31" beta = True - # make this True is you want to create a portable app - that is, to save the settings files - # in the working directory - portable = True # current date now date = str(datetime.today()).rpartition('.')[0] @@ -209,7 +206,26 @@ class App(QtCore.QObject): App.log.debug("Win32!") else: App.log.debug("Win64!") - if self.portable is False: + + portable = False + config_file = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '\\config\\configuration.txt' + try: + with open(config_file, 'r') as f: + try: + for line in f: + param = str(line).rpartition('=') + if param[0] == 'portable': + try: + portable = eval(param[2]) + except NameError: + portable = False + except Exception as e: + log.debug('App.__init__() -->%s' % str(e)) + return + except FileNotFoundError: + pass + + if portable is False: self.data_path = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, None, 0) + '\FlatCAM' else: self.data_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) diff --git a/README.md b/README.md index fcf1f9e0..c4285be6 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing. - merged pull request from Mike Smith that add support for a new SVG element: - stored inside FlatCAM app the VisPy data files and at the first start the application will try to copy those files to the APPDATA (roaming) folder in case of running under Windows - created an app 'switch' named 'self.portable' which when set True it will 'cx-freeze' an portable application +- created a configuration file in the root/config/configuration.txt with a configuration line for portability. Set portable to True to run the app as portable 14.08.2019 diff --git a/config/configuration.txt b/config/configuration.txt new file mode 100644 index 00000000..fca42d67 --- /dev/null +++ b/config/configuration.txt @@ -0,0 +1 @@ +portable=False \ No newline at end of file diff --git a/make_win.py b/make_win.py index 4e5986b3..f486e304 100644 --- a/make_win.py +++ b/make_win.py @@ -56,6 +56,7 @@ include_files.append(("locale", "lib/locale")) include_files.append(("postprocessors", "lib/postprocessors")) include_files.append(("share", "lib/share")) include_files.append(("flatcamGUI/VisPyData", "lib/vispy")) +include_files.append(("config", "lib/config")) include_files.append(("README.md", "README.md")) include_files.append(("LICENSE", "LICENSE"))