I know I have posted quite a lot, but I am learning things about the AmigaOS 4 and I am really curious about what is happening.
Here is a classic example of what has been happening to me recently:
1. Try some cross compilation which inevitably is to build an executable built for my Amiga named "main"
2. SCP main to the Amiga's RAM Disk
3. Forget about the protection flags and run "main" in Shell
4. Get confused as to why when I do that a completely different program that I created called "main" gets executed!
So, since I am used to Linux it is quite a bewildering feature that the other MAIN program has a "symbolic link" in APPDIR: and since the AmigaOS does not see the actual "main" that I SCP'd as executable, it goes and runs the one that has a symbolic link created for it in APPDIR: since that is on the PATH.
I have to note that AmigaOS 4 is not Linux, but this is an.. interesting feature.
3. Forget about the protection flags and run "main" in Shell.
4. Get confused as to why when I do that a completely different program that I created called "main" gets executed!
So, since I am used to Linux
But if you forgot to set the executable bit in Linux, wouldn't you potentially see the same, depending on your search path and the existance of other programs in it with the same name?
Normally, the APPDIR feature shouldn't cause any problems, because it is set to be last in the path by default.
The intent of the appdir feature is that for most "normal" users, they can just use the program name in a shell (with no path) or in the default tool of a project, and it will launch the program from wherever it was last run, which would normally be what you want.
For some users (us beta testers for example), it can sometimes be a bit of a nuisance, and if the above description does not match what you normally want, you have to think about how (or whether) you use it. E.g. by explicitly stating paths, or by launching a program from within its directory (current dir is always earlier in the path than appdir - unless you've changed the default setup).
In cases of doubt, a "Which <program> ALL" is your friend.
@rjd324 Also, make sure you have S:startup-sequence 53.12 as it changed in the way the appdir: path was added. For example, it used to just be on the end of the "Path" line, now it is no longer there but instead has its own area just before the "LoadWB" line as;
Assign >nil: exists APPDIR: if NOT WARN Path ADD APPDIR: endif
The reason it was done like this is to allow people that have the SDK installed to get the APPDIR: path always at the very end, and to also provide a test so that you don't get a pester-requester, if you happen to turn it off.
I still do not use AppDir, in the sense that I comment out the adding of it to the path in the ss file. In fact, every boot I delete the contents of it. Futile, of course because the OS will continue to create links there every session.
Some 3rd party scripts rely on it.
There is no way to actually stop the OS from creating links in APPDIR:, right?
BTW, I can see the benefits of it. It means that I don't need to hack 3rd party scripts and provide the path to my own installations etc. Regardless, still wondering if you can disable the creation of links in full.
If liberty means anything at all, it means the right to tell people what they do not want to hear. George Orwell.
I think you can just move the DEVS:DOSdrivers/APPDIR entry to the SYS:Storage/DOSdrivers/ directory and reboot... et viola, it's gone?
I agree with nbache, APPDIR: evolved into a reasonable solution for most common user cases. Run something once and things then just work for them the vast majority of the time.
Otherwise, using complete paths, assignments and so forth are the easy solutions of pro-users for overriding control.
@rjd324 Of course you can disable it simply by moving the APPDIR icon (via workbench) from the DEVS/DOSDRIVERS drawer to STORAGE/DOSDRIVERS drawer and then doing a reboot.
Don't edit the startup-sequence as you mentioned, just leave it as it was so you can still get it auto-added to the path when required.
If you want to mount APPDIR afterwards, you can just double click on the icon in STORAGE/DOSDRIVERS yourself, or in a shell, type; Mount APPDIR: (Note the colon on the end).
@rjd324 I'd suggest you use the dismount to deactivate it when you specifically don't want it. I'm sure there are scripts and even programs that use the appdir feature to find and execute external applications. These might fail if appdir is disabled.