diff options
author | Kalle-Samuli Riihikoski <haikalle@gmail.com> | 2020-11-23 10:46:20 +0300 |
---|---|---|
committer | Kalle-Samuli Riihikoski <haikalle@gmail.com> | 2020-11-23 10:46:20 +0300 |
commit | 348467f8e3880783a1badb09ecfe07afaeb03753 (patch) | |
tree | 28c82bd773a6416b5413f2aac4b3684f16c177a2 /io_coat3D/folders.py | |
parent | 075a0e12cdc06c99079bf8867304b23fe2e1fb60 (diff) |
io_coat3D: better exchange folder set up
Diffstat (limited to 'io_coat3D/folders.py')
-rw-r--r-- | io_coat3D/folders.py | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/io_coat3D/folders.py b/io_coat3D/folders.py index ab143083..ad54bf71 100644 --- a/io_coat3D/folders.py +++ b/io_coat3D/folders.py @@ -35,9 +35,9 @@ def InitFolders(): break folderPath.close() - if(os.path.isdir(os.path.abspath(savedExchangePath)) and savedExchangePath.rfind('Exchange') >= 0): - coat3D.exchangeFolder = savedExchangePath - return True, coat3D.exchangeFolder + + coat3D.exchangeFolder = savedExchangePath + return True, coat3D.exchangeFolder # 2. ################################################################# @@ -94,6 +94,35 @@ def updateExchangeFile(newPath): file.write("%s"%(newPath)) file.close() +def loadExchangeFolder(): + + platform = os.sys.platform + coat3D = bpy.context.scene.coat3D + + if(platform == 'win32' or platform == 'darwin'): + DC2Folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + else: + DC2Folder = os.path.expanduser("~") + os.sep + '3DC2Blender' + + exchangeFile = DC2Folder + os.sep + 'Exchange_folder.txt' + + if(not os.path.isdir(DC2Folder)): + os.mkdir(DC2Folder) + + if(not os.path.isfile(exchangeFile)): + file = open(exchangeFile, 'w') + file.close() + else: + savedExchangePath = '' + folderPath = open(exchangeFile) + + for line in folderPath: + savedExchangePath = line + break + folderPath.close() + coat3D.exchangeFolder = savedExchangePath + + def set_working_folders(): platform = os.sys.platform |