robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
396 stars 48 forks source link

PC-BASIC doesn't honor the "Start In" directory #115

Closed mgregory22 closed 4 years ago

mgregory22 commented 4 years ago

Bug report

Problem I want to start PC-BASIC in the directory where I want to save and load my BASIC programs, but it seems to ignore the path and saves things in the root directory of the drive.

Test #1 Steps

  1. Find the PC-BASIC shortcut icon
  2. Right-click on it and change the "Start In" directory to "D:\Prog\Basic"
  3. Click Apply, enter Administrator password
  4. Click OK
  5. Run the program with the icon
  6. LOAD"MAINMENU REM D:\Prog\Basic\MAINMENU.BAS exists
  7. File not found

Test #2 Steps

  1. Run the program with the icon
  2. 10 PRINT "HELLO"
  3. SAVE"TEST
  4. File gets saved as D:\TEST.BAS

Notes PC-BASIC version: 2.0.2 Operating system version: Windows 10 Home

robhagemans commented 4 years ago

I'm sorry, but I can't reproduce this issue. On Windows 10 if I change the "start In" folder the default directory changes as expected. What is the output of the "FILES" command, do you see "MAINMENU.BAS" there? Is there perhaps a typo in the name of the "start in" directory, or maybe some access restriction?

mgregory22 commented 4 years ago

Hmm, this has been my luck with computers lately. Weird errors that nobody else can reproduce.

It can't be typo because I can copy the path from the Start In box and paste it into the address bar of Windows Explorer and it takes me there.

No, there are no access restrictions. I was using the actual GWBASIC in there before I discovered PC-BASIC, but that was through DosBox.

The FILES shows me D:\ and its contents. I actually forgot all about that command.

Oh, and I see there is a CHDIR command, so this isn't as big of a deal as I thought. I can get there through CHDIR.

I can't imagine what's wrong. I have the icon pinned to the Start menu, which shouldn't affect anything. I have the UAC set up so that you have to enter the password every time, so that's a little weird. Other than that, I don't think there's anything weird in my setup (although I'm probably forgetting something because I tweak things all the time).

Thanks anyway for trying!

mgregory22 commented 4 years ago

Oh and thanks for writing this program! You did a great job. I know it's probably not the most lucrative thing in the world to do, but I really have a fondness for this old BASIC and I love those old BASIC programs that people wrote in the 80's. They had a lot of great ideas.

robhagemans commented 4 years ago

Hmm, I'd suspect the UAC maybe to be the key. If it runs as Administrator or something maybe that changes matters. Though PCBASIC just checks what the OS tells it is the current directory, and AFAIK that should be the "Start In" folder. To be honest, I don't know much about Windows 10, as I left our Redmond friends around Windows XP (never looked back, etc, etc.) and the newer versions have no end of confusing trickery with the file system. Maybe someone who understands the latest Windowses a bit better can help out...

mgregory22 commented 4 years ago

I don't run it as admin. The only reason I brought up UAC is I remembered having to enter my password, and that happened when I changed the Start In value. The shortcut turns out to be in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PC-BASIC 2.0 which I understand as the global start menu for all user accounts.

robhagemans commented 4 years ago

OK, in that case I have no idea why it's not working on your setup. Not sure where shortcuts are normally stored, I tend to click on "show in folder" or some such in the right-click menu and modify the shortcut there.

robhagemans commented 4 years ago

I'm closing this as I can't reproduce and there has been no further activity. Please feel free to re-open if new information becomes available.

mgregory22 commented 4 years ago

I was looking at this page: https://docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-prepare and it made me wonder: Do you package the windows installer with MSIX? The "Your application uses the current working directory" bullet point on that page says that the working directory changes when you package it that way and you have to manually chdir to the original working directory.

robhagemans commented 4 years ago

I use cx_Freeze and msilib - the start-in path is set to a default in the shortcut which can then be changed by the user. If you'e interested in the detail of how it's packaged, see package.py in the repository root.