Game Development Community

Mor File actions?

by CodingChris · in Torque Game Engine · 01/12/2007 (4:17 am) · 5 replies

Hi,
are there console function for delete, move, copy, cut, paste a file?
I searched the forums but I found nothing.
Hope for help.

#1
01/12/2007 (5:02 am)
Try...
#2
01/12/2007 (6:33 am)
Hey Christian. After browsing the Torque File Class Reference (official engine documentation from the creators), TDN, and some forums, I sadly report that there appears to be no file functionality similar to what you want...

However, I do know how to implement these changes if you are interested. The changes can be done in script or engine (you make the choice). Also, where would you be using this functionality? Would this be called from a GUI, or behind the scenes?
#3
01/12/2007 (6:40 am)
It would be called from the a GUI and behind the scenes. It's better from script I think, but if it's easier for you do in the engine.
#4
01/12/2007 (7:46 am)
Apparently I didn't search hard enough. I remember seeing a couple of threads a while back covering this subject, I just used the wrong words to search for.

Use these:
fileDelete("filePath")
pathCopy("sourceFilePath", "destFilePath", overwriteToggle)

Example:
function copyFile(%filePath)
{
    $CopiedFilePath = %filePath;
}

function pasteFile(%destinationFilePath, %overwriteFileIfExists, %pasteFromCutFile)
{
     pathCopy($CopiedFilePath, %destinationFilePath, %overwriteFileIfExists);
     if(%pasteFromCutFile)
     {
               fileDelete($CopiedFilePath);
               $CopiedFilePath = 0;
      }
}

function moveFile(%sourceFilePath, %destinationFilePath, %overwriteFileIfExists)
{
      pathCopy(%sourceFilePath, %destinationFilePath, %overwriteFileIfExists);
      fileDelete($CopiedFilePath);
}

*EDIT*- Of course, you'll want to put in safety checks to prompt the user, letting them know if they are about to permanently delete or overwrite files. Other than that, I just tested those functions and I was able to copy, cut, paste, and move files from the Console. You just have to attach the functions to a GUI control or a hotkey.
#5
01/12/2007 (8:10 am)
Thanks