help with getting turing to check if a file exists
Author |
Message |
CodeMonkey2000
|
Posted: Sun Dec 17, 2006 8:16 pm Post subject: help with getting turing to check if a file exists |
|
|
ok, is there a way to check(within turing) if a file exists? say i have a zelda game that's useing 2d mapping, and when it gets to an area i havent stored in a data file, i want it say "Sorry this area is not yet complete", so when i do get around to finishing the area, the program automatically detects that the file exists and displays the area, with out me having to change the code? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Sun Dec 17, 2006 8:27 pm Post subject: (No subject) |
|
|
Yeah, the function File.Exists is exactly what you're looking for. |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Sun Dec 17, 2006 9:10 pm Post subject: (No subject) |
|
|
Wow, now once you know that file doesn't exist, is there a way to make turing create it? i'm making a level editor for my mario game, and it saves all the objects in a data file, and asks then the user what they want to save it as (the file does'nt exist but I want turing to create it). |
|
|
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Sun Dec 17, 2006 9:40 pm Post subject: (No subject) |
|
|
Yeah. I'm pretty sure that if you write to a file that doesn't exist, it will be created for you. This might not be the same if you try appending to a file (using the mod option). Test it out, and report back here! ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Sun Dec 17, 2006 9:49 pm Post subject: (No subject) |
|
|
Also you can use Dir.Create to create a folder if it is not yet created ![Very Happy Very Happy](http://compsci.ca/v3/images/smiles/icon_biggrin.gif) |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Sun Dec 17, 2006 10:04 pm Post subject: (No subject) |
|
|
well Dir.Create works,and writing in a file that doesnt exist works too, so i guess it's good either wya . |
|
|
|
|
![](images/spacer.gif) |
|
|