BBC BASIC for Windows
General >> General Board >> BB4W has corrupted @dir$ with a *.BAS http://bb4w.conforums.com/index.cgi?board=general&action=display&num=1256530527 BB4W has corrupted @dir$ with a *.BAS
Post by 19Grumpah42 on Oct 26th, 2009, 04:15am
I hope someone can help me. During programme development I 'suddenly' found that BB4W would not load any library files. This was because its @dir$ was now at the WinXP default (C:\Documents and Settings\Grahame Pratt\My Documents\). The correct @dir$ (after a new instance of BB4W is run) is P:\BBC_BASIC\Examples\
I have progressively stripped my code down to the following which contains only one command (END). I have laundered this through the *.BAS version, opened and resaved it from MS Notepad, and used my HEX editor to confirm that the only op codes in the file are pairs of &0d&0a.
REM automated LAN ping tester (ex Richard Russel) : REM HIMEM=LOMEM+8000000 :REM 8Mby REM INSTALL @lib$+"SOCKLIB" REM INSTALL @lib$+"WINLIB3" REM INSTALL @lib$+"WINLIB5" REM INSTALL @lib$+"SPRITELIB" REM ON CLOSE PROC_cleanup : END : REM MODE 18 :REM just to start : REM PROC_initsockets REM PROC_ini_ping REM *FONT Terminal,6 REM PROC_gets_cfg REM PROC_sets_window : REM PROC_writes_labels REM PROC_load_sprite : REM *ESC OFF REM ON ERROR GOTO 270 REM OFF REM now%=FALSE REM PROC_run_sprite REM +++++++++++ The ping loop .... REM SYS "SetTimer", @hwnd%, 101, 5000, 0 :REM Send pings every 5 sec. or whatever. in milliseconds REM ON TIME PROC_ping_loop :RETURN : REM PROC_cleanup END REM **********************************
If I run a new BB4W instance, load this .BAS file, then do {Run}{Immediate mode} >PRINT @dir$ I get the incorrect location. This error is permanently installed in that instance of BB4W so I have to close it because I cannot use it for any of my programmes.
Does anybody have a clue what is going on? I would appreciate learning how I might fix this, it's totally new to me. --Grahame
Re: BB4W has corrupted @dir$ with a *.BAS
Post by 19Grumpah42 on Oct 26th, 2009, 04:34am
Whoops, sorry about the mistake at the top of the last. The directory handle which gets corrupted is @dir$ (@lib$ remains true) so the programme probably does load its library files, it just won't load my file(s). --Grahame P.S. I spent 10 hours on this so far, so any(!) suggestions will be greatly appreciated, and please don't worry about me getting egg on my face. Thanks..
Re: BB4W has corrupted @dir$ with a *.BAS
Post by 19Grumpah42 on Oct 26th, 2009, 04:51am
OK, I found my problem, sorry about all that fuss.
At some stage there had been a glitch, because BB4W had decided to save my latest version in the WinXP default directory (which I never use for anything, on principle), without my knowing. After that, I was just re-loading programs from the {File} drop down list, which doesn't say where they were. That was why the @dir$ was wrong!
Yes, egg indeed; at least I will know what to look for if it happens again. --Grahame
Re: BB4W has corrupted @dir$ with a *.BAS
Post by admin on Oct 26th, 2009, 10:22am
Quote:
The correct @dir$ (after a new instance of BB4W is run) is P:\BBC_BASIC\Examples\
When a new instance of BB4W is run (i.e. before any BASIC program is loaded) @dir$ is set to the current directory. If BB4W was run from a shortcut, that is determined by the contents of the Start In field of the shortcut.
After you've loaded a BASIC program, @dir$ is set to the directory from which that program was loaded.
Quote:
At some stage there had been a glitch, because BB4W had decided to save my latest version in the WinXP default directory
That is normal behaviour if you use 'Save As' rather than 'Save'.
When you use 'Save As' BB4W has to be very careful that the directory to which it will (by default) save the program is writable. If you have previously successfully used Save As, it will use the directory that you used on that occasion. If you have never used Save As since the last installation (or upgrade) of BB4W, it will by default save the program to the user's Documents folder, since that is guaranteed writable.
This behaviour is essential to avoid novice users being totally befuddled when running BB4W under Windows Vista. Typically they will load an example program (from C:\Program Files\...) make some modifications to it and then attempt to save it under a new name. If Save As defaulted to the directory from which the program was loaded it would fail, because C:\Program Files\ is not ordinarily writable.
The moral is, whenever BB4W presents you with a Save File dialogue box, check (and if necessary change) the directory; do not assume it will be the same as the directory from which the program was loaded - in general it won't be unless you've previously done a Save As to there.
Richard.
Re: BB4W has corrupted @dir$ with a *.BAS
Post by 19Grumpah42 on Oct 26th, 2009, 4:50pm
Yes, I understand the argument Richard. Yet another compromise of common sense to suit MS' autocratic vision of the perfect PC world. That's OK, nothing abnormal there. This redirecting {Save As} reminds me somewhat of the French traffic law "priorité ŕ droite": Seems unbelievable, but boy (!) you had better pay keen attention. --Grahame