Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions UI/obs-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,15 @@ static bool MakeUserProfileDirs()
return true;
}

static bool MakeRecordingDir()
{
string path = GetDefaultVideoSavePath();
if (!do_mkdir(path.c_str()))
return false;

return true;
}

static string GetProfileDirFromName(const char *name)
{
string outputPath;
Expand Down Expand Up @@ -1180,6 +1189,8 @@ void OBSApp::AppInit()

if (!MakeUserDirs())
throw "Failed to create required user directories";
if (!MakeRecordingDir())
throw "Failed to create recording directory";
Comment on lines +1192 to +1193
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be unnecessary as the directory is created on demand when a recording is started. OBS should not create an empty folder in the user's video folder just from being run.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It does not create the folder on demand in my testing
    image

  2. I disagree and believe the folder should be initialized when OBS first runs like any app other storage location

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't an app storage location though, this is the user's data folders. Well-designed apps should respect a user's folder layout and not create empty files and directories.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have some sort of guidance or documentation from Microsoft about that?

I have multiple applications on my system that have created folders for themselves in the Videos library location

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just good behavior, just because other apps are shitty doesn't mean we should also be shitty. There's plenty of evidence of of users who desire such behavior from their apps.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One's shitty behaviour is another's expected behaviour though. And by that token I'd rather have an application create files in its own managed subdirectory than mess up the root of a data storage location.

I do agree that the directory should be created upon first use though. I don't remember Shadowplay creating directories for recordings or highlights until I actually triggered either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I concur with first use, as a user who does not enjoy all the random empty folders I have no intention of using.

if (!InitGlobalConfig())
throw "Failed to initialize global config";
if (!InitLocale())
Expand Down
18 changes: 12 additions & 6 deletions UI/platform-osx.mm
Comment thread
Warchamp7 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,20 @@ void CheckIfAlreadyRunning(bool &already_running)

string GetDefaultVideoSavePath()
{
NSFileManager *fm = [NSFileManager defaultManager];
NSURL *url = [fm URLForDirectory:NSMoviesDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true
error:nil];
NSFileManager *defaultManager = [NSFileManager defaultManager];
NSURL *moviesDirectory = [defaultManager URLForDirectory:NSMoviesDirectory inDomain:NSUserDomainMask
appropriateForURL:nil
create:YES
error:nil];

if (!url)
return getenv("HOME");
if (moviesDirectory) {
const string videoSavePath =
[moviesDirectory URLByAppendingPathComponent:@"OBS-Studio" isDirectory:YES].path.fileSystemRepresentation;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[moviesDirectory URLByAppendingPathComponent:@"OBS-Studio" isDirectory:YES].path.fileSystemRepresentation;
[moviesDirectory URLByAppendingPathComponent:@"OBS Studio" isDirectory:YES].path.fileSystemRepresentation;

Shouldn't this just be "OBS Studio"? Spaces are fine to pass as a component to this function, and I'm not aware of any issues with spaces in folder names for OBS.


return url.path.fileSystemRepresentation;
return videoSavePath;
}

return getenv("HOME");
}

vector<string> GetPreferredLocales()
Expand Down
2 changes: 2 additions & 0 deletions UI/platform-windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ string GetDefaultVideoSavePath()
SHGetFolderPathW(NULL, CSIDL_MYVIDEO, NULL, SHGFP_TYPE_CURRENT,
path_utf16);

wcscat(path_utf16, L"\\OBS Studio");

os_wcs_to_utf8(path_utf16, wcslen(path_utf16), path_utf8, MAX_PATH);
return string(path_utf8);
}
Expand Down
2 changes: 1 addition & 1 deletion UI/platform-x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ bool GetDataFilePath(const char *data, string &output)

string GetDefaultVideoSavePath()
{
return string(getenv("HOME"));
return string(getenv("HOME")) + "/OBS Studio";
}

vector<string> GetPreferredLocales()
Expand Down