Skip to content

Commit

Permalink
logic to move files into root dir (BrettMayson#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Inmaan committed Apr 29, 2023
1 parent 907f4d7 commit 3d86d80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
14 changes: 14 additions & 0 deletions launch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import re
from pathlib import Path
import shutil
import subprocess
from string import Template

Expand All @@ -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"

Expand All @@ -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 = []
Expand Down

0 comments on commit 3d86d80

Please sign in to comment.