From 5b83cece9ab88d0f5d7ceb7388e59980c8d7ba73 Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Fri, 2 Jul 2021 13:54:13 -0500 Subject: [PATCH] Path: Add tools `README.md` file to tools working directory on install This code copies all files in the default (program install location) Path\Tools folder to the user's working tools folder when they setup the ToolBit working directories for the first time. --- src/Mod/Path/CMakeLists.txt | 12 ++++++++++++ src/Mod/Path/PathScripts/PathToolBitLibraryGui.py | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt index 6b78b5ea38..4c6589a9ad 100644 --- a/src/Mod/Path/CMakeLists.txt +++ b/src/Mod/Path/CMakeLists.txt @@ -164,6 +164,10 @@ SET(PathScripts_post_SRCS PathScripts/post/uccnc_post.py ) +SET(Tools_SRCS + Tools/README.md +) + SET(Tools_Bit_SRCS Tools/Bit/45degree_chamfer.fctb Tools/Bit/5mm-thread-cutter.fctb @@ -254,6 +258,7 @@ SET(Path_Data SET(all_files ${PathScripts_SRCS} ${PathScripts_post_SRCS} + ${Tools_SRCS} ${Tools_Bit_SRCS} ${Tools_Library_SRCS} ${Tools_Shape_SRCS} @@ -306,6 +311,13 @@ INSTALL( Mod/Path/PathScripts/post ) +INSTALL( + FILES + ${Tools_SRCS} + DESTINATION + Mod/Path/Tools +) + INSTALL( FILES ${Tools_Bit_SRCS} diff --git a/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py b/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py index 7a70425944..2a7b8ed182 100644 --- a/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py +++ b/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py @@ -85,6 +85,14 @@ def checkWorkingDir(): PathPreferences.setLastPathToolBit("{}{}Bit".format(workingdir, os.path.sep)) PathLog.debug('setting workingdir to: {}'.format(workingdir)) + # Copy only files of default Path\Tools folder to working directory (targeting the README.md help file) + src_toolfiles = os.listdir(defaultdir) + for file_name in src_toolfiles: + if file_name in ["README.md"]: + full_file_name = os.path.join(defaultdir, file_name) + if os.path.isfile(full_file_name): + shutil.copy(full_file_name, workingdir) + subdirlist = ['Bit', 'Library', 'Shape'] mode = 0o777 for dir in subdirlist.copy():