Author Topic: Checking for a file  (Read 1160 times)

How would I make a part so that it checks for a certain .cs, and if it doesn't exist, cancel the code underneath, if it does then the code works?

You could use isfile

if(isFile("Add-Ons/lolcs")) { //blah } I think is how it's used, but that's stupid because if you use that and the file isn't there, then when the file is created, and you try it again, it will still return false until the server restarts.

Another way, is to read all of the file and check if it's blank, if it is, presume the file doesn't exist. A stupid method, i admit, but it's more effective than the other one >_>


Lemme be more specific, I want to have a pack with scripts that modify my mods, and it will contain the scripts for all of them, but I want the scripts to check if the .cs it works for is there, if it isn't then it wont do anything, if it is it will carry on normally.

if(!isFile("Add-Ons/Yourfile.cs") == TRUE) //I don't know if it returns true or 1 or not false or whatever.
{
return;
} else {
//stuff
}

if(isFile("Add-Ons/Yourfile.cs"))
{
        //doStuff.
}
else
        return;

I dont get what your trying to do?