latenitefilms / BRAWToolbox

Help & Support for BRAW Toolbox
https://brawtoolbox.io
MIT License
13 stars 1 forks source link

Investigate new method for getting the user's home path #97

Closed latenitefilms closed 1 year ago

latenitefilms commented 1 year ago

Reported by Kevin Lyons.

We're currently using the below code to get the users home directory:

- (NSString*)getUserHomeDirectoryPath {
    struct passwd *pw = getpwuid(getuid());
    assert(pw);
    return [NSString stringWithUTF8String:pw->pw_dir];
}

This works in 99% of cases, however, in Kevin's case, for whatever reason he has two user folders, one called "kevin" and one called "kevin 1" - and BRAW Toolbox is trying to access the "kevin" folder, which it doesn't have access too. I'm not exactly sure how this scenario manifested - but the "kevin" account seems to be an older user account that's no longer used, and no longer appears in the "Users & Groups" System Preferences.

The workaround for Kevin was to just install the Motions Templates, LUTs and Metadata Definitions manually, however it would be good to have a permanent solve.

I previously tried NSHomeDirectory() but it returns the application’s sandbox directory, and that was causing some complications, but I can't remember specifically what they were, so will need to look into this again.

latenitefilms commented 1 year ago

This will be fixed in v1.0.8.