Where should I store my files?

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Where should I store my files?

Postby iPlayer » 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:

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Nov 20, 2015 3:25 pm

If you look at the readme placeholder files, they will tell you what the plugin/custom directories are for. Map specific data is fine in the maps directory, as they aren't really specific to SP. Sounds can go into the ../sound/source-python/ directory, but I don't believe we aren't going to enforce that it be used.

There is no need to directly create a log file yourself, same with cfg files, as we have functionality already to create them for you.

Thank you for pointing out the comments in the paths module, it seems Ayuto has fixed them.
Image
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Postby iPlayer » Fri Nov 20, 2015 3:40 pm

Thanks for your reply.

So, data/plugins is for plugins data and data/custom is for data from custom packages. If I understood it correctly, custom packages are any custom libs that I want to put for use with my plugins - I can use that folder for my personal needs.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Fri Nov 20, 2015 3:48 pm

satoon101 wrote:Sounds can go into the ../sound/source-python/ directory, but I don't believe we aren't going to enforce that it be used.
Few years ago, we wanted to enfore them but the reason we went that route was that we wanted our Sound, Model, etc. classes to accept any existing files on the server. :)
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Nov 20, 2015 3:49 pm

Custom packages are for packages that any plugin can also use. The only currently available one is Mahi's EasyPlayer. It's designed for common use functionalities not built into SP itself.
Image
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Nov 20, 2015 3:54 pm

L'In20Cible wrote:
satoon101 wrote:Sounds can go into the ../sound/source-python/ directory, but I don't believe we aren't going to enforce that it be used.
Few years ago, we wanted to enfore them but the reason we went that route was that we wanted our Sound, Model, etc. classes to accept any existing files on the server. :)


I believe to "play" sounds, they do have to be in the ../sound/ directory. Our Sound class is designed to play any sound in the ../sound/ directory. We "could" require that plugins posted to SPPM (once it is actually a thing), that have sounds that are released with the plugin, utilize the ../sound/source-python/ directory.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 164 guests