Skip to content

Commit e84869f

Browse files
Fix macos app data path
1 parent 4da88ba commit e84869f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Certify.Shared/Utils/EnvironmentUtil.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ public static string EnsuredAppDataPath(string subDirectory = null, bool skipCre
9494
Models.SharedConstants.APPDATASUBFOLDER
9595
};
9696

97+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
98+
{
99+
// macos incorrectly returns the common app data path as /usr/share but that's not writeable even by root, has to be usr/local/share
100+
parts = new List<string>()
101+
{
102+
"/usr/local/share",
103+
Models.SharedConstants.APPDATASUBFOLDER
104+
};
105+
}
106+
97107
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CERTIFY_APPDATA_PATH")))
98108
{
99109
parts = new List<string> { Environment.GetEnvironmentVariable("CERTIFY_APPDATA_PATH") };

0 commit comments

Comments
 (0)