Merge Folders
Posted: Sat Oct 02, 2021 1:23 am
Hey!
I'm currently trying to write an updater for my plugin and I encountered a problem.
So what it basically does is download the master version, unzip it into a temporary folder, remove existing files and then extract the unzipped files to the server files.
The only problem with this is, if SOURCE_PATH contains a newly created directory, which does not exist in GAME_PATH, it raises:
SOURCE_PATH:
GAME_PATH:
Is there a possible way to create all missing directories and sub-directories of SOURCE_PATH e.g: ../addons/source-python or ..addons/source-python/custom/certifi or is there maybe even a better way to extract SOURCE_PATH into GAME_PATH
I'm currently trying to write an updater for my plugin and I encountered a problem.
So what it basically does is download the master version, unzip it into a temporary folder, remove existing files and then extract the unzipped files to the server files.
Syntax: Select all
from distutils.dir_util import copy_tree
from paths import GAME_PATH
SOURCE_PATH = GAME_PATH / "update"
copy_tree(SOURCE_PATH, GAME_PATH)
The only problem with this is, if SOURCE_PATH contains a newly created directory, which does not exist in GAME_PATH, it raises:
SOURCE_PATH:
../source-python/packages/custom/certifi/cacert.pem
GAME_PATH:
../source-python/packages/custom
Code: Select all
distutils.errors.DistutilsFileError: could not create '..\addons\source-python\packages\custom\certifi\cacert.pem': No such file or directory
Is there a possible way to create all missing directories and sub-directories of SOURCE_PATH e.g: ../addons/source-python or ..addons/source-python/custom/certifi or is there maybe even a better way to extract SOURCE_PATH into GAME_PATH