[Plugin] Profile Path

mwaack

New Member
To the Path where the current Profile is.
Like .../obs-studio/basic/profiles/currentprofile
Need it to save an image.
 

dodgepong

Administrator
Community Helper
You need to save an image in the profile directory? That doesn't sound right to me...what are you trying to do?

Sorry, I'm not trying to avoid answering the question, it's just one of those times where the question doesn't make sense to me and makes me wonder if there is a misunderstanding going on that is prompting the question.
 

mwaack

New Member
I have a Websocket, there comes an Image and maybe text.
The Text gets drawn on the Image and the Image is in the Scene.
Over the Websocket the text can be changed, so the Image must updated.

The Image is an overlay like in TV-News at the bottom with the text from current the speaker.
So the Image must saved and best location i think is the Profile(Scene) Path.
 

dodgepong

Administrator
Community Helper
And this is for a custom plugin you're making? What about giving the user an option of what image to use in the source properties, and maybe include a default inside the plugin directory itself?
 
As far as I'm aware (and I may not be fully aware), you can get the path to the binary (the plugin folder) and the path to the data folder. Both are in libobs/obs.h
Code:
const char* obs_data_path = obs_get_module_data_path(obs_current_module());    //path to data
const char* obs_bin_path = obs_get_module_binary_path(obs_current_module());   //path to binary

obs_current_module() gets the current plugin (aka module)
obs_data_path will then be something like C:\Program Files\obs-studio\data\obs-plugins\plugin-name
obs_bin_path will then be something like C:\Program Files\obs-studio\obs-plugins\32bit (I assume, I've never used this one)
I'm not sure if it consistently returns the absolute path or relative path, you may have to write a routine to check.

It may not be ideal for your needs because, if memory serves (and it doesn't always), Windows doesn't like you writing to C:\Program Files (running OBS as admin gets around this). Evidently, if OBS is installed somewhere else this won't be a problem. I think Linux and Mac are less restrictive but I'm not sure.
 
Top