Skip to content

Instantly share code, notes, and snippets.

@black-silence
Created March 11, 2017 23:22
Show Gist options
  • Save black-silence/ce5f0cafa6e1303ff277ac5d881e737f to your computer and use it in GitHub Desktop.
Save black-silence/ce5f0cafa6e1303ff277ac5d881e737f to your computer and use it in GitHub Desktop.
workaround for Aragami editor version 1
#!/usr/bin/env python3
import os
import glob
workshop = os.path.join(os.getcwd(), "workshop", "content", "280160")
os.chdir(workshop)
c = d = 0
# Remove existing symlinks
scan = os.scandir(workshop)
for item in scan:
if item.is_symlink():
os.remove(os.path.join(workshop, item.name))
d += 1
# Make new symlinks
datafiles = glob.glob("*/*.031")
for item in datafiles:
os.symlink(item, item.replace(os.sep, "\\", 1))
c += 1
datafiles = glob.glob("*/*.bytes")
for item in datafiles:
os.symlink(item, item.replace(os.sep, "\\", 1))
c += 1
try:
custom = os.path.expanduser("~/.config/unity3d/Lince Works/Aragami/LevelEditor/CustomLevels")
os.chdir(custom)
scan = os.scandir(custom)
for item in scan:
if item.is_symlink():
os.remove(os.path.join(workshop, item.name))
d += 1
datafiles = glob.glob("*/*.031")
for item in datafiles:
os.symlink(item, item.replace(os.sep, "\\", 1))
c += 1
datafiles = glob.glob("*/*.bytes")
for item in datafiles:
os.symlink(item, item.replace(os.sep, "\\", 1))
c += 1
except:
pass # Sorry mac users
print("Done, removed {} old and created {} new symlinks".format(d, c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment