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? |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Cervantes

|
Posted: Sun Dec 17, 2006 8:27 pm Post subject: (No subject) |
|
|
Yeah, the function File.Exists is exactly what you're looking for. |
|
|
|
|
 |
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). |
|
|
|
|
 |
Cervantes

|
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!  |
|
|
|
|
 |
Clayton

|
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  |
|
|
|
|
 |
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 . |
|
|
|
|
 |
|
|