示例#1
0
        // CreateFile(u32 mode, u64 size, buffer<bytes<0x301>, 0x19, 0x301> path)
        public long CreateFile(ServiceCtx context)
        {
            string name = ReadUtf8String(context);

            long mode = context.RequestData.ReadInt64();
            int  size = context.RequestData.ReadInt32();

            string fileName = _provider.GetFullPath(name);

            if (fileName == null)
            {
                return(MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist));
            }

            if (_provider.FileExists(fileName))
            {
                return(MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists));
            }

            if (IsPathAlreadyInUse(fileName))
            {
                return(MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse));
            }

            return(_provider.CreateFile(fileName, size));
        }
示例#2
0
        // CreateFile(u32 mode, u64 size, buffer<bytes<0x301>, 0x19, 0x301> path)
        public long CreateFile(ServiceCtx Context)
        {
            string Name = ReadUtf8String(Context);

            long Mode = Context.RequestData.ReadInt64();
            int  Size = Context.RequestData.ReadInt32();

            string FileName = Provider.GetFullPath(Name);

            if (FileName == null)
            {
                return(MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist));
            }

            if (Provider.FileExists(FileName))
            {
                return(MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists));
            }

            if (IsPathAlreadyInUse(FileName))
            {
                return(MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse));
            }

            return(Provider.CreateFile(FileName, Size));
        }