Hey folks,
I wanna give you a suggestion for the _libs/paths.py file. The name "ADDON_PATH" is confusing (at least for former ES coders). Why not change that to "PLUGIN_PATH" - since it points to <srcds>/csgo/addons/source-python - and add a function called GetAddonPath(addon_name) that returns PLUGIN_PATH + "/addons/" + addon_name?
paths.py suggestion
if you want to know the path of your addon.. try this:
There are several ways to do it... but this is something that can easily be handled inside python without any libraries.
Syntax: Select all
from os import path
my_file_dir = path.dirname(path.abspath(__file__))
There are several ways to do it... but this is something that can easily be handled inside python without any libraries.
I prefer .parent to .dirname(), but they do the same thing. And, you can also, since ADDON_PATH is a path instance itself, just use:
And in reference to the original question, I am not sure if you noticed, but CFG_PATH and LOG_PATH also specify the "source-python" folder within their respective directories. This is basically to set a proper standard of where log files and cfg files will be stored. Once we start work on a translation system, there will probably be a TRANSLATION_PATH, or something like that, that points directly to a path where all translation files should be based out of. I guess, to avoid confusion, we could change ADDON_PATH to ADDONS_PATH, but I'm not sure how confusing the former actually is.
Satoon
Syntax: Select all
from paths import ADDON_PATH
myaddon_path = ADDON_PATH.joinpath('myaddon_name')
And in reference to the original question, I am not sure if you noticed, but CFG_PATH and LOG_PATH also specify the "source-python" folder within their respective directories. This is basically to set a proper standard of where log files and cfg files will be stored. Once we start work on a translation system, there will probably be a TRANSLATION_PATH, or something like that, that points directly to a path where all translation files should be based out of. I guess, to avoid confusion, we could change ADDON_PATH to ADDONS_PATH, but I'm not sure how confusing the former actually is.
Satoon
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 132 guests