mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Fix - ln -s on Linux and Popen is weird
This commit is contained in:
parent
efc4ba8b6c
commit
0a9d2cde7f
1 changed files with 19 additions and 16 deletions
35
start.py
35
start.py
|
|
@ -292,24 +292,27 @@ def run_disk_mapping_commands(mongo_url):
|
||||||
return
|
return
|
||||||
|
|
||||||
mappings = disk_mapping.get(low_platform) or []
|
mappings = disk_mapping.get(low_platform) or []
|
||||||
if low_platform == "windows":
|
|
||||||
command = "subst"
|
|
||||||
else:
|
|
||||||
command = "ln -s"
|
|
||||||
for source, destination in mappings:
|
for source, destination in mappings:
|
||||||
args = [command, destination.rstrip('/'), source.rstrip('/')]
|
destination = destination.rstrip('/')
|
||||||
_print("disk mapping args:: {}".format(args))
|
source = source.rstrip('/')
|
||||||
try:
|
if low_platform == "windows":
|
||||||
output = subprocess.Popen(args)
|
args = ["subst", destination, source]
|
||||||
if output.returncode and output.returncode != 0:
|
_print("disk mapping args:: {}".format(args))
|
||||||
exc_msg = "Executing args was not successful: \"{}\"".format(
|
try:
|
||||||
args)
|
output = subprocess.Popen(args)
|
||||||
|
if output.returncode and output.returncode != 0:
|
||||||
raise RuntimeError(exc_msg)
|
exc_msg = "Executing was not successful: \"{}\"".format(
|
||||||
except TypeError:
|
args)
|
||||||
_print("Error in mapping drive")
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
raise RuntimeError(exc_msg)
|
||||||
|
except TypeError:
|
||||||
|
_print("Error in mapping drive")
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
if not os.path.exists(destination):
|
||||||
|
os.symlink(source, destination)
|
||||||
|
else:
|
||||||
|
_print("Destination {} already exists".format(destination))
|
||||||
|
|
||||||
def set_avalon_environments():
|
def set_avalon_environments():
|
||||||
"""Set avalon specific environments.
|
"""Set avalon specific environments.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue