BBC BASIC for Windows
« File exists »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:41pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: File exists  (Read 982 times)
MrStreet
New Member
Image


member is offline

Avatar




PM


Posts: 8
sad 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.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
sad 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.
User IP Logged

MrStreet
New Member
Image


member is offline

Avatar




PM


Posts: 8
sad 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?
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
sad 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.
User IP Logged

MrStreet
New Member
Image


member is offline

Avatar




PM


Posts: 8
sad Re: File exists
« Reply #11 on: Jun 8th, 2011, 8:19pm »

Many thanks again, Richard.
User IP Logged

MrStreet
New Member
Image


member is offline

Avatar




PM


Posts: 8
sad 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
 
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls