Author |
Topic: Re: [RC] Unix/ls (Read 905 times) |
|
tsh73
Full Member
member is offline


Gender: 
Posts: 210
|
 |
Re: [RC] Unix/ls
« Reply #11 on: Oct 27th, 2016, 2:19pm » |
|
Quote:| The first is when the program is executed in DOS, or by a DOS .BAT file, and the current directory is different than the directory where the .exe file resides. In this case, StartupDir$ is set to the current directory at the time the program is executed. This procedure is not, however, normally done by the user of a program |
| About >> This procedure is not, however, normally done by the user of a program I really read task as "recreate UNIX ls" which is program executed from a command line. Really, command line still has its uses.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: [RC] Unix/ls
« Reply #12 on: Oct 27th, 2016, 3:49pm » |
|
on Oct 27th, 2016, 2:19pm, tsh73 wrote:| I really read task as "recreate UNIX ls" which is program executed from a command line. |
|
Of course in LBB you can create a console application and make it look exactly like ls or dir. In LB 4 the best you can do is to display the output in a window; it's not clear from the task description at RC whether that qualifies as a solution or not.
Richard.
|
|
Logged
|
|
|
|
Jack Kelly
Full Member
member is offline


Gender: 
Posts: 106
|
 |
Re: [RC] Unix/ls
« Reply #13 on: Feb 7th, 2017, 06:55am » |
|
Ah, ha. That explains my confusion, Richard. A while back I mentioned that when I start LBB, DefaultDir$ is set to my Windows 'Temp' directory. Anatoly thought that was because LBB referenced that directory during its initilization. Is there any way I can make LBB set DefaultDir$ to the directory where I started it?
on Oct 25th, 2016, 11:16am, Jack Kelly wrote:I've been looking with some confusion at Anatoly's trials and tribulations over directories. I'm running XP (still...). When I start LBB and run 'print DefaultDir$' I get
Code:C:\DOCUME~1\Jack\LOKALE~1\Temp
Where does this come from? I was never aware of such a 'Temp' directory, much less ever having used it. But it has never presented any problem to my knowledge. |
|
Thanks, Jack
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: [RC] Unix/ls
« Reply #14 on: Feb 7th, 2017, 1:53pm » |
|
on Feb 7th, 2017, 06:55am, Jack Kelly wrote:| Is there any way I can make LBB set DefaultDir$ to the directory where I started it? |
|
I don't think so, but there's a good reason. When you run an unsaved BASIC program, LBB has to store a temporary copy of it somewhere because it's run in a separate process. The temporary directory is pretty much the only place in the entire Windows filing system that is guaranteed to exist and guaranteed to be writable.
If LBB were instead to attempt to set DefaultDir$ to your startup directory, that's where it would have to put the temporary copy of your unsaved program. There's no certainly that it could save anything there (for example it might be a directory under C:\Program Files (x86)\ which are non-writable without admin privileges) nor that it should.
So LBB takes a safe course. If you haven't saved your program, so you haven't explicitly said "here is a directory that I am happy for you to store files in" it uses the one place that it definitely can: the temporary directory.
When you run a program from the LB 4 IDE I think it runs 'in process' and does not need to be saved somewhere temporarily (BBC BASIC for Windows works that way too). But LBB does need to save it first.
Richard.
|
|
|
|
|