Made an option to specify original project folder name for link data.

This commit is contained in:
Victorious Children Studios 2023-12-20 15:56:09 +02:00
parent cd853f42aa
commit 89e5d35768

View file

@ -80,6 +80,12 @@ except:
print("Please specify a port number and then project folder.") print("Please specify a port number and then project folder.")
exit() exit()
try:
ORIGINAL_PROJECT = sys.argv[3]
except:
print("Orignal Project Name Was Not Specified.")
ORIGINAL_PROJECT = " not a folder that can exist "
def fileinfo(filename): def fileinfo(filename):
fd = {} fd = {}
@ -171,8 +177,16 @@ class handler(BaseHTTPRequestHandler):
parsed = [] parsed = []
for i in linked: for i in linked:
if i.startswith(PROJECT):
# This is a little weird, sometimes the files have the full URL
# to the data.
if i.startswith(PROJECT): # This is good when the server is on the same machine as the orignal project
parsed.append(i[len(PROJECT):]) parsed.append(i[len(PROJECT):])
elif i.startswith(ORIGINAL_PROJECT): # This is when the server is a mirror
parsed.append(i[len(ORIGINAL_PROJECT):])
else: else:
backward = i.count("/..") backward = i.count("/..")
foldername = filename[:filename.rfind("/")] foldername = filename[:filename.rfind("/")]