mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Ensure EnsureDirectoryExists works properly
This commit is contained in:
parent
b03973dc48
commit
ea2572c479
3 changed files with 11 additions and 5 deletions
|
@ -233,7 +233,9 @@ namespace LibHac.Fs
|
|||
// path[i] will be a '/', so skip that character
|
||||
i++;
|
||||
|
||||
for (; i < path.Length; i++)
|
||||
// loop until `path.Length - 1` so CreateDirectory won't be called multiple
|
||||
// times on path if the last character in the path is a '/'
|
||||
for (; i < path.Length - 1; i++)
|
||||
{
|
||||
if (path[i] == '/')
|
||||
{
|
||||
|
@ -242,6 +244,8 @@ namespace LibHac.Fs
|
|||
fs.CreateDirectory(subPath);
|
||||
}
|
||||
}
|
||||
|
||||
fs.CreateDirectory(path);
|
||||
}
|
||||
|
||||
public static void CreateOrOverwriteFile(this IFileSystem fs, string path, long size)
|
||||
|
|
|
@ -145,7 +145,9 @@ namespace LibHac.Fs
|
|||
// path[i] will be a '/', so skip that character
|
||||
i++;
|
||||
|
||||
for (; i < path.Length; i++)
|
||||
// loop until `path.Length - 1` so CreateDirectory won't be called multiple
|
||||
// times on path if the last character in the path is a '/'
|
||||
for (; i < path.Length - 1; i++)
|
||||
{
|
||||
if (path[i] == '/')
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace hactoolnet
|
|||
{
|
||||
public static void Process(Context ctx)
|
||||
{
|
||||
FileAccess accessNeeded = FileAccess.Read;
|
||||
var accessNeeded = FileAccess.Read;
|
||||
|
||||
if (ctx.Options.SignSave || ctx.Options.ReplaceFileDest != null && ctx.Options.ReplaceFileSource != null ||
|
||||
ctx.Options.RepackSource != null || ctx.Options.TrimSave)
|
||||
|
|
Loading…
Reference in a new issue