Author |
Topic: File exists (Read 982 times) |
|
MrStreet
New Member
member is offline


Posts: 8
|
 |
Re: File exists
« Reply #7 on: Jun 8th, 2011, 4:32pm » |
|
Quote:| ...check whether GAME_NAME$ contains any illegal characters... |
|
This shouldn't create an illegal folder name, should it?
Code: GAME_NAME$ = "You Tube Video Cleaner"
I haven't had chance to try the updated (debug) version on the networked machines yet, but deleting the folder created by PROC_checkSetup (my documents\My_You Tube Video Cleaner_Projects) fixes the problem (until you run it again). The program stills works as expected on my stand-alone machine.
I am very confused. The ability to create a folder when the program first runs, and then using it to save files to would be very handy, although I could create a work-around.
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: File exists
« Reply #8 on: Jun 8th, 2011, 5:39pm » |
|
on Jun 8th, 2011, 4:32pm, MrStreet wrote:| The ability to create a folder when the program first runs, and then using it to save files to would be very handy |
|
You can definitely do that (at the risk of repeating myself, you can do virtually anything that is possible in Windows, since BBC BASIC for Windows is a general purpose programming language).
Even if you cannot get your existing code to work there are straightforward workarounds such as creating the folder using SYS "CreateDirectory", which doesn't fail if it already exists.
But ideally you should find out why the current code isn't working, since that might point to a more fundamental issue with your program.
Quote:| I haven't had chance to try the updated (debug) version on the networked machines yet |
|
Networked machines? Have you mentioned that before? If the folder you're testing for is on a network server running an 'unusual' filing system (e.g. SAMBA), then maybe relying on the file NUL existing in every directory isn't valid.
Richard.
|
|
Logged
|
|
|
|
MrStreet
New Member
member is offline


Posts: 8
|
 |
Re: File exists
« Reply #9 on: Jun 8th, 2011, 5:42pm » |
|
Can't I create the NUL file using the usual OPENOUT and put it into the projects folder when the program creates it the first time?
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: File exists
« Reply #10 on: Jun 8th, 2011, 8:17pm » |
|
on Jun 8th, 2011, 5:42pm, MrStreet wrote:| Can't I create the NUL file using the usual OPENOUT and put it into the projects folder when the program creates it the first time? |
|
You can't create a NUL file - it's a forbidden file name. But since you are wanting to test for the existence of a directory which you have created yourself, why not simply store a file there specifically for the purpose? Because you know that file will always be there, you can simply test for it being present - you don't actually need to test for the existence of the directory itself!
Richard.
|
|
Logged
|
|
|
|
MrStreet
New Member
member is offline


Posts: 8
|
 |
Re: File exists
« Reply #11 on: Jun 8th, 2011, 8:19pm » |
|
Many thanks again, Richard.
|
|
Logged
|
|
|
|
MrStreet
New Member
member is offline


Posts: 8
|
 |
Re: File exists
« Reply #12 on: Jun 11th, 2011, 11:24am » |
|
I think I have fixed the problem using an on error local statement call to :-
Code:
deffn_setupError
if err=196 then
rem file exists error
= false
else
if fn_FAULT_M(" I am sorry the following error occured during setup: "+LF$+LF$+report$+LF$+LF$+" Do you want to quit?") then
= true
else
=false
endif
endif
|
|
Logged
|
|
|
|
|