Fix path issues for a few miscelaneous tools on Windows.
This commit is contained in:
parent
42f57e10d7
commit
d4faa9f7d8
@ -139,7 +139,7 @@ class Data:
|
||||
return False
|
||||
|
||||
def __alembic_cmd(self, command: str, *args: str) -> None:
|
||||
base_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'migrations/')
|
||||
base_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'migrations')
|
||||
alembicArgs = [
|
||||
'-c',
|
||||
os.path.join(base_dir, 'alembic.ini'),
|
||||
|
@ -76,14 +76,14 @@ class IFS:
|
||||
def get_children(parent: str, node: Node) -> None:
|
||||
real_name = self.__fix_name(node.name)
|
||||
if node.data_type == '3s32':
|
||||
node_name = os.path.join(parent, real_name).replace('/imgfs/', '')
|
||||
node_name = os.path.join(parent, real_name).replace(f'{os.sep}imgfs{os.sep}', '')
|
||||
files[node_name] = (node.value[0] + data_index, node.value[1], node.value[2])
|
||||
else:
|
||||
for subchild in node.children:
|
||||
get_children(os.path.join(parent, f"{real_name}/"), subchild)
|
||||
get_children(os.path.join(parent, f"{real_name}{os.sep}"), subchild)
|
||||
|
||||
# Recursively walk the entire filesystem extracting files and their locations.
|
||||
get_children("/", header)
|
||||
get_children(os.sep, header)
|
||||
|
||||
for fn in files:
|
||||
(start, size, pack_time) = files[fn]
|
||||
@ -92,9 +92,9 @@ class IFS:
|
||||
|
||||
# Now, find all of the index files that are available.
|
||||
for filename in list(self.__files.keys()):
|
||||
abs_filename = ("/" if filename.startswith("/") else "") + filename
|
||||
abs_filename = (os.sep if filename.startswith(os.sep) else "") + filename
|
||||
|
||||
if abs_filename.endswith("/texturelist.xml"):
|
||||
if abs_filename.endswith(f"{os.sep}texturelist.xml"):
|
||||
# This is a texture index.
|
||||
texdir = os.path.dirname(filename)
|
||||
|
||||
@ -156,7 +156,7 @@ class IFS:
|
||||
rect[2] // 2,
|
||||
rect[3] // 2,
|
||||
)
|
||||
elif abs_filename.endswith("/afplist.xml"):
|
||||
elif abs_filename.endswith(f"{os.sep}afplist.xml"):
|
||||
# This is a texture index.
|
||||
afpdir = os.path.dirname(filename)
|
||||
bsidir = os.path.join(afpdir, "bsi")
|
||||
|
@ -157,7 +157,7 @@ def render_react(
|
||||
'react.html',
|
||||
**{
|
||||
'title': title,
|
||||
'reactbase': os.path.join('controllers/', controller),
|
||||
'reactbase': os.path.join('controllers', controller),
|
||||
'inits': inits,
|
||||
'links': links,
|
||||
},
|
||||
@ -234,8 +234,8 @@ def valid_pin(pin: str, type: str) -> bool:
|
||||
def navigation() -> Dict[str, Any]:
|
||||
# Look up JSX components we should provide for every page load
|
||||
components = [
|
||||
os.path.join('components/', f)
|
||||
for f in os.listdir(os.path.join(static_location, 'components/'))
|
||||
os.path.join('components', f)
|
||||
for f in os.listdir(os.path.join(static_location, 'components'))
|
||||
if re.search(r'\.react\.js$', f)
|
||||
]
|
||||
|
||||
|
@ -457,9 +457,9 @@ def main() -> int:
|
||||
|
||||
if ifsfile is not None:
|
||||
for fname in ifsfile.filenames:
|
||||
if fname.startswith("geo/"):
|
||||
if fname.startswith(f"geo{os.sep}"):
|
||||
# Trim off directory.
|
||||
shapename = fname[4:]
|
||||
shapename = fname[(3 + len(os.sep)):]
|
||||
|
||||
# Load file, register it.
|
||||
fdata = ifsfile.read_file(fname)
|
||||
@ -468,9 +468,9 @@ def main() -> int:
|
||||
|
||||
if args.verbose:
|
||||
print(f"Added {shapename} to SWF shape library.", file=sys.stderr)
|
||||
elif fname.startswith("tex/") and fname.endswith(".png"):
|
||||
elif fname.startswith(f"tex{os.sep}") and fname.endswith(".png"):
|
||||
# Trim off directory, png extension.
|
||||
texname = fname[4:][:-4]
|
||||
texname = fname[(3 + len(os.sep)):][:-4]
|
||||
|
||||
# Load file, register it.
|
||||
fdata = ifsfile.read_file(fname)
|
||||
@ -479,10 +479,10 @@ def main() -> int:
|
||||
|
||||
if args.verbose:
|
||||
print(f"Added {texname} to SWF texture library.", file=sys.stderr)
|
||||
elif fname.startswith("afp/"):
|
||||
elif fname.startswith(f"afp{os.sep}"):
|
||||
# Trim off directory, see if it has a corresponding bsi.
|
||||
afpname = fname[4:]
|
||||
bsipath = f"afp/bsi/{afpname}"
|
||||
afpname = fname[(3 + len(os.sep)):]
|
||||
bsipath = f"afp{os.sep}bsi{os.sep}{afpname}"
|
||||
|
||||
if bsipath in ifsfile.filenames:
|
||||
afpdata = ifsfile.read_file(fname)
|
||||
|
Loading…
x
Reference in New Issue
Block a user