public DirectoryEntryType GetEntryType(string path) { string fullPath = GetFullPath(PathTools.Normalize(path)); lock (Locker) { return(BaseFs.GetEntryType(fullPath)); } }
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, string path) { string fullPath = GetFullPath(PathTools.Normalize(path)); lock (Locker) { return(BaseFs.GetEntryType(out entryType, fullPath)); } }
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path) { Unsafe.SkipInit(out FsPath fullPath); Result rc = ResolveFullPath(fullPath.Str, path); if (rc.IsFailure()) { UnsafeHelpers.SkipParamInit(out entryType); return(rc); } lock (Locker) { return(BaseFs.GetEntryType(out entryType, fullPath)); } }
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path) { FsPath fullPath; unsafe { _ = &fullPath; } // workaround for CS0165 Result rc = ResolveFullPath(fullPath.Str, path); if (rc.IsFailure()) { entryType = default; return(rc); } lock (Locker) { return(BaseFs.GetEntryType(out entryType, fullPath)); } }
private Result Initialize(bool isPersistentSaveData, bool canCommitProvisionally) { IsPersistentSaveData = isPersistentSaveData; CanCommitProvisionally = canCommitProvisionally; // Ensure the working directory exists Result rc = BaseFs.GetEntryType(out _, WorkingDirectoryPath); if (rc.IsFailure()) { if (!ResultFs.PathNotFound.Includes(rc)) { return(rc); } rc = BaseFs.CreateDirectory(WorkingDirectoryPath); if (rc.IsFailure()) { return(rc); } if (!IsPersistentSaveData) { return(Result.Success); } rc = BaseFs.CreateDirectory(CommittedDirectoryPath); // Nintendo returns on all failures, but we'll keep going if committed already exists // to avoid confusing people manually creating savedata in emulators if (rc.IsFailure() && !ResultFs.PathAlreadyExists.Includes(rc)) { return(rc); } } // Only the working directory is needed for temporary savedata if (!IsPersistentSaveData) { return(Result.Success); } rc = BaseFs.GetEntryType(out _, CommittedDirectoryPath); if (rc.IsSuccess()) { return(SynchronizeDirectory(WorkingDirectoryPath, CommittedDirectoryPath)); } if (!ResultFs.PathNotFound.Includes(rc)) { return(rc); } // If a previous commit failed, the committed dir may be missing. // Finish that commit by copying the working dir to the committed dir rc = SynchronizeDirectory(SynchronizingDirectoryPath, WorkingDirectoryPath); if (rc.IsFailure()) { return(rc); } return(BaseFs.RenameDirectory(SynchronizingDirectoryPath, CommittedDirectoryPath)); }
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path) { return(BaseFs.GetEntryType(out entryType, path)); }