From 3d86d804ed0d6e667c34c6236ffca7afc4854281 Mon Sep 17 00:00:00 2001 From: Inmaan Date: Sat, 29 Apr 2023 12:24:25 -0400 Subject: [PATCH 1/3] logic to move files into root dir (#62) --- README.md | 1 + launch.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index da8893b..5e6ca6a 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Profiles are saved in `/arma3/configs/profiles` | `-v /arma3/configs` | Folder containing config files | | `-v /arma3/mods` | Mods that will be loaded by clients | | `-v /arma3/servermods` | Mods that will only be loaded by the server | +| `-v /arma3/move_to_root` | Will move any files into the Arma 3 server root directory, for example .dll files | | `-e PORT` | Port used by the server, (uses PORT to PORT+3) | 2302 | | `-e ARMA_BINARY` | Arma 3 server binary to use, `./arma3server_x64` for x64 | `./arma3server` | | `-e ARMA_CONFIG` | Config file to load from `/arma3/configs` | `main.cfg` | diff --git a/launch.py b/launch.py index 3ce22e5..0ac01de 100644 --- a/launch.py +++ b/launch.py @@ -1,5 +1,7 @@ import os import re +from pathlib import Path +import shutil import subprocess from string import Template @@ -15,6 +17,7 @@ def env_defined(key): return key in os.environ and len(os.environ[key]) > 0 +BASE_DIR = Path(os.getcwd()).resolve() CONFIG_FILE = os.environ["ARMA_CONFIG"] KEYS = "/arma3/keys" @@ -37,6 +40,17 @@ def env_defined(key): steamcmd.extend(["validate", "+quit"]) subprocess.call(steamcmd) + +# move any FILES to root dir like .dll +if os.path.exists(BASE_DIR / "move_to_root"): + for file in os.listdir(BASE_DIR / "move_to_root"): + # Check if the path is a directory + if os.path.isdir(BASE_DIR / "move_to_root" /file): + print('f{file} is a directory, create a volume link instead') + else: + # Copy the file and overwrite if it already exists + shutil.copy2(BASE_DIR / "move_to_root" / file, BASE_DIR / file) + # Mods mods = [] From a5ca1923ad39984f45e05c21663f2ca63b7ddd96 Mon Sep 17 00:00:00 2001 From: Inmaan Date: Sat, 13 May 2023 00:11:53 -0400 Subject: [PATCH 2/3] linter fixes for (#62) --- launch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/launch.py b/launch.py index 0ac01de..5aeec3e 100644 --- a/launch.py +++ b/launch.py @@ -1,8 +1,9 @@ import os import re -from pathlib import Path import shutil import subprocess + +from pathlib import Path from string import Template import local @@ -45,11 +46,11 @@ def env_defined(key): if os.path.exists(BASE_DIR / "move_to_root"): for file in os.listdir(BASE_DIR / "move_to_root"): # Check if the path is a directory - if os.path.isdir(BASE_DIR / "move_to_root" /file): + if os.path.isdir(BASE_DIR / "move_to_root" / file): print('f{file} is a directory, create a volume link instead') else: # Copy the file and overwrite if it already exists - shutil.copy2(BASE_DIR / "move_to_root" / file, BASE_DIR / file) + shutil.copy2(BASE_DIR / "move_to_root" / file, BASE_DIR / file) # Mods From a9701609d31ee9ec5d1fd52b6be7fecdd88865a6 Mon Sep 17 00:00:00 2001 From: Inmaan Date: Sat, 13 May 2023 00:11:53 -0400 Subject: [PATCH 3/3] linter fixes for (#62) --- launch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/launch.py b/launch.py index 0ac01de..97f7bad 100644 --- a/launch.py +++ b/launch.py @@ -1,9 +1,9 @@ import os import re -from pathlib import Path import shutil import subprocess from string import Template +from pathlib import Path import local import workshop @@ -45,11 +45,11 @@ def env_defined(key): if os.path.exists(BASE_DIR / "move_to_root"): for file in os.listdir(BASE_DIR / "move_to_root"): # Check if the path is a directory - if os.path.isdir(BASE_DIR / "move_to_root" /file): + if os.path.isdir(BASE_DIR / "move_to_root" / file): print('f{file} is a directory, create a volume link instead') else: # Copy the file and overwrite if it already exists - shutil.copy2(BASE_DIR / "move_to_root" / file, BASE_DIR / file) + shutil.copy2(BASE_DIR / "move_to_root" / file, BASE_DIR / file) # Mods