Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_OpenFile Dialog in same folder as exe
#16
(12-05-2022, 05:54 AM)SMcNeill Wrote: Just remember to use _CWD$ at the start of the program, and to save the result to a non-changing variable.  If you navigate to different folders, your _CWD$ isn't going to be the same one that you started in.

Code: (Select All)
$If WIN Then
    Dim Shared As String * 1 Slash: Slash = "\"
$Else
        Dim Shared As String * 1 Slash: Slash = "/"
$End If

Dim Shared As String ExePath
ExePath = _CWD$

CHDIR "C:\"
Print ExePath, _CWD$

(12-05-2022, 10:47 AM)Pete Wrote: Brings back memories. Back in the ol' days we had to use a SHELL DIR to get the current folder. I used CHDIR a lot, so I always did the SHELL call then set a variable DIM SHARED OrigDir to the original directory the exe was running in.

Pete

Yes 2 thumbs up from one thread! I think I will call slash, OSslash$, and it probably is better as fixed string.

Actually my OP code would work better for code where I was pasting on forward slash or backslash?... (geez those are worse than left or right!)  I was building pathed filenames with Linux slash because Windows didn't care so OSslash$ will have to be new code.

Very good! 

Pete, it does remind me of the shell like program I made back in DOS days. I remember having something rewriting a batch file as you use the batch file. Pretty cool stuff to modify a program (this more a script I suppose) as you Run it.
b = b + ...
Reply


Messages In This Thread
_OpenFile Dialog in same folder as exe - by bplus - 12-04-2022, 08:28 PM
RE: _OpenFile Dialog in same folder as exe - by bplus - 12-05-2022, 06:38 PM



Users browsing this thread: 7 Guest(s)