Skip to content

Commit

Permalink
Use glob for gathering workshop keys
Browse files Browse the repository at this point in the history
  • Loading branch information
arron1993 committed Mar 21, 2022
1 parent b453a6d commit 14251d7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions keys.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import os
import glob
import shutil


def copy(moddir):
keysdir = os.path.join(moddir, "keys")
if os.path.exists(keysdir):
for o in os.listdir(keysdir):
keyfile = os.path.join(keysdir, o)
if not os.path.isdir(keyfile):
shutil.copy2(keyfile, "/arma3/keys")
keys = glob.glob(os.path.join(moddir, '**/*.bikey'))
if len(keys) > 0:
for key in keys:
if not os.path.isdir(key):
shutil.copy2(key, "/arma3/keys")
else:
print("Missing keys:", keysdir)
print("Missing keys:", moddir)


if __name__ == '__main__':
for moddir in glob.glob("/arma3/steamapps/workshop/content/107410/*"):
copy(moddir)

0 comments on commit 14251d7

Please sign in to comment.