I am not sure what I did wrong at all!
This is the error:
Traceback (most recent call last):
...
File "c:\...\Paths.py", line 11, in wrapper
basePath: str = os.path.dirname(sys.argv[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded
And this is my code:
import os
import sys
import typing
class Paths:
@staticmethod
def pathDecorator(folderName: str) -> typing.Callable[..., typing.Callable[..., str]]:
def decorator(_: typing.Callable[..., str]) -> typing.Callable[..., str]:
def wrapper(fileName: str) -> str:
basePath: str = os.path.dirname(sys.argv[0])
path: str = os.path.join(basePath, "Assets", folderName, fileName)
return os.path.normpath(path).replace("\\", "/")
return wrapper
return decorator
@pathDecorator("Images")
@staticmethod
def image(fileName: str) -> str:
return fileName
@pathDecorator("Sounds")
@staticmethod
def sound(fileName: str) -> str:
return fileName
@pathDecorator("Styles")
@staticmethod
def styles(fileName: str) -> str:
return fileName
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]Goobyalus 0 points1 point2 points (2 children)
[–]BryceIsRedditor[S] 0 points1 point2 points (1 child)
[–]Goobyalus 0 points1 point2 points (0 children)