Beispiel #1
0
    public override string command_function()
    {
        if (argv.Length != 3)
        {
            return(this.malformed_error + "\n" + this.usage);
        }

        IGC_FileSystem fs = virtualSystem.fileSystem;



        IGC_URL
            oldURL = fs.ParseURL(argv[1], issuer.cwd),
            newURL = fs.ParseURL(argv[2], issuer.cwd);

        if (!fs.FileExists(oldURL.fullpath))
        {
            return("cant move " + argv[1] + " because it doesn't exist");
        }
        Debug.Log("from " + oldURL.fullpath);
        if (!fs.FileExists(newURL.dirpath))
        {
            return("cant move " + argv[1] + " to " + newURL.dirname + " because that directory does not exist.");
        }
        Debug.Log("to " + newURL.dirpath);
        if (fs.FileExists(newURL.fullpath))
        {
            return("new path " + argv[2] + " already exists - have you added the file name to the path?");
        }
        Debug.Log("to fullpath " + newURL.fullpath);

        IGC_File file = fs.GetFile(oldURL.fullpath);
        IGC_File dir  = fs.GetFile(newURL.dirpath);

        if (!fs.CanAccessFile(file, issuer))
        {
            return("you do not have permission to edit " + oldURL.fullpath);
        }
        if (!fs.CanAccessFile(dir, issuer))
        {
            return("you do not have permission to access " + newURL.dirname);
        }

        if (argv[2] == "SVR-01")
        {
        }
        //if svr get gameobject tagged playerserver - move the file from current gameobject to the playerserver gameobject
        //new move file method in FS required, one that takes gameobjects - convert this to extract command?
        fs.MoveFile(oldURL, newURL);

        if (virtualSystem.networkReady)
        {
            fs.GetComponent <NetworkView>().RPC("MoveFileRPC", RPCMode.Others, oldURL.fullpath, newURL.fullpath);
        }

        return(oldURL.filename + " changed to " + newURL.fullpath);
    }
Beispiel #2
0
    public override string command_function()
    {
        if (argv.Length != 3)
        {
            return(this.malformed_error + "\n" + this.usage);
        }

        IGC_FileSystem fs = virtualSystem.fileSystem;

        IGC_URL
            target = fs.ParseURL(argv[1], issuer.cwd),
            copy   = fs.ParseURL(argv[2], issuer.cwd);

        if (!fs.FileExists(target.fullpath))
        {
            return("cant copy " + target.fullpath + " because it doesn't exist");
        }
        if (!fs.FileExists(copy.dirpath))
        {
            return("cant copy " + target.filename + " to " + copy.dirname + " because that directory does not exist.");
        }
        if (fs.FileExists(copy.fullpath))
        {
            return(copy.fullpath + " already exists");
        }

        IGC_File file = fs.GetFile(target.fullpath);
        IGC_File dir  = fs.GetFile(copy.dirpath);

        if (!fs.CanAccessFile(file, issuer))
        {
            return("you do not have permission to copy " + target.fullpath);
        }
        if (!fs.CanAccessFile(dir, issuer))
        {
            return("you do not have permission to access " + copy.dirname);
        }


        fs.CopyFile(target, copy);

        if (virtualSystem.networkReady)
        {
            fs.GetComponent <NetworkView>().RPC("CopyFileRPC", RPCMode.Others, target.fullpath, copy.fullpath);
        }

        return(target.filename + " copied to " + copy.fullpath);
    }
Beispiel #3
0
    public override string command_function()
    {
        if (argv.Length != 3)
        {
            return(this.malformed_error + "\n" + this.usage);
        }

        IGC_FileSystem fs = virtualSystem.fileSystem;

        IGC_URL
            oldURL = fs.ParseURL(argv[1], issuer.cwd),
            newURL = fs.ParseURL(argv[2], issuer.cwd);

        if (!fs.FileExists(oldURL.fullpath))
        {
            return("cant move " + argv[1] + " because it doesn't exist");
        }
        if (!fs.FileExists(newURL.dirpath))
        {
            return("cant move " + argv[1] + " to " + newURL.dirname + " because that directory does not exist.");
        }
        if (fs.FileExists(newURL.fullpath))
        {
            return("new path " + argv[2] + " already exists");
        }

        IGC_File file = fs.GetFile(oldURL.fullpath);
        IGC_File dir  = fs.GetFile(newURL.dirpath);

        if (!fs.CanAccessFile(file, issuer))
        {
            return("you do not have permission to edit " + oldURL.fullpath);
        }
        if (!fs.CanAccessFile(dir, issuer))
        {
            return("you do not have permission to access " + newURL.dirname);
        }

        fs.MoveFile(oldURL, newURL);

        if (virtualSystem.networkReady)
        {
            fs.GetComponent <NetworkView>().RPC("MoveFileRPC", RPCMode.Others, oldURL.fullpath, newURL.fullpath);
        }

        return(oldURL.filename + " changed to " + newURL.fullpath);
    }