Where should I store my files?
Posted: Fri Nov 20, 2015 2:52 pm
Hey there again,
Today's question is about files. On ES I was kinda "nobody cares anyways" but with SP I don't want any problems regarding where I put my libs/resources when I release my plugin.
But before I start, I must say it took me a while to figure out what's actually going on in source-python/packages/source-python/paths.py
Take a look:
Seems legit, right? Going further
These actually point to ../cfg/source-python and ../sound/source-python respectively, but comments state otherwise. I took configs and sound just as an example, problem occurs with all paths based on GAME_PATH.
So. Where I store my files now:
The next question is what's difference between CUSTOM_DATA_PATH and PLUGIN_DATA_PATH?
Last question leads to another, final question: where do I put my libs that should be accessible globally by several plugins? I suppose somewhere in packages/custom, am I right? Because you have 'plugins' and 'custom' data paths, I thought I'd find both packages/custom and packages/plugins folders.
Thanks in advance.
Today's question is about files. On ES I was kinda "nobody cares anyways" but with SP I don't want any problems regarding where I put my libs/resources when I release my plugin.
But before I start, I must say it took me a while to figure out what's actually going on in source-python/packages/source-python/paths.py
Take a look:
Syntax: Select all
#: ../<game>
GAME_PATH = Path(Path(__file__).rsplit('addons', 1)[0])
#: ../addons/source-python
BASE_PATH = GAME_PATH / 'addons' / 'source-python'
Seems legit, right? Going further
Syntax: Select all
#: ../addons/source-python/cfg/source-python
CFG_PATH = GAME_PATH / 'cfg' / 'source-python'
Syntax: Select all
#: ../addons/source-python/sound/source-python
SOUND_PATH = GAME_PATH / 'sound' / 'source-python'
These actually point to ../cfg/source-python and ../sound/source-python respectively, but comments state otherwise. I took configs and sound just as an example, problem occurs with all paths based on GAME_PATH.
So. Where I store my files now:
- Logs go into <mod>/logs/source-python/<plugin name>, saved with .log extension under reasonable names.
- Configs go directly into <mod>/cfg/<fancy plugin name>. I'm not sure if I should place them in <mod>/cfg/source-python/<plugin name> or not.
- INI-configs (not cvars) go into a subfolder of the folder above.
- All submodules go somewhere into my plugin folder, <mod>/addons/source-python/plugins/<plugin name>/...
- Sounds, models and materials go directly into sound, models and materials though. If I ever release ES version too, that would make my plugin a bit more cross-platform. And, my existing players won't have to redownload all the stuff again.
- Map-specific data (vmf-based data that plugins can use) go in either <mod>/maps (together with the map) or <mod>/mapdata. I'm not going to store it in /addons/source-python/data. Imagine you're a gamebanana moderator and you decided to check a new map. How long will it take you to hit the 'ban' button if you see both addons and maps folders in the .zip? Further more, such data can prove useful for other plugins or plugins run on ES/SM.
The next question is what's difference between CUSTOM_DATA_PATH and PLUGIN_DATA_PATH?
Last question leads to another, final question: where do I put my libs that should be accessible globally by several plugins? I suppose somewhere in packages/custom, am I right? Because you have 'plugins' and 'custom' data paths, I thought I'd find both packages/custom and packages/plugins folders.
Thanks in advance.