Closed
Description
Currently, the mode argument is used to create missing parents too.
I would like to change it to only apply to the leaf directory.
This is consistent with mkdir
which doesn't use the -m <mode>
argument for parents (-p
flag).
It avoids unintentionally creating parent directories with wrong permissions.
For example:
// Create app data folder with `700` permission.
string appPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.DoNotVerify), "my-app");
Directory.CreateDirectory(appPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
@eerhardt @adamsitnik @dotnet/area-system-io do you agree? If so, I'll make a PR to implement this change.