Page 1 of 2

Problem with the path to the Library folder

Posted: Thu Aug 27, 2020 3:13 pm
by garryp4
I'm having a problem with Swordfish creating a library directory in the wrong place. The correct path to the library is c:\ProgramData\Mecanique|Swordfish\Library. However, when I select some modules from the Code Explorer list, and if that module is in c:\users\g\documents\swordfish\userlibrary, that module opens up. I have completely deleted the library under c:\users and Swordfish will the open the correct library. But the next time I launch Swordfish the c:\users\g\documents\swordfish\userlibrary directory is recreated again. I have completely uninstalled Swordfish, ren CCCleaner registry clean, Deleted every Swordfish directory, then searched the registry with RegEdit and looked for any reference to Swordfish. It appeared to be completely wipped from my laptop. Then I re-loaded the newest rev of Swordfish and get the exact same issue. I can duplicate this every time. Anyone have any ideas?

Thanks,
Garry

Re: Problem with the path to the Library folder

Posted: Thu Aug 27, 2020 3:17 pm
by garryp4
Also, I have just set up a fresh tower PC and loaded Swordfish and do not get this problem. Both are running Windows 10.

Re: Problem with the path to the Library folder

Posted: Sat Aug 29, 2020 8:53 am
by bitfogav
I'm not sure that what you are seeing is incorrect..
Swordfish will always look in the C:\User\Documents library before looking in the C:\ProgramData library.
A Swordfish library on my windows 10 Installs in C:\ProgrammeData and it will always recreate a user library in C:\User\Documents..

Re: Problem with the path to the Library folder

Posted: Sat Aug 29, 2020 2:16 pm
by garryp4
Any updates go to the c:\ProgramData\Mecanique|Swordfish\Library so it seems Swordfish should look there first, then the working directory. Otherwise the libraries will not be current.

Re: Problem with the path to the Library folder

Posted: Sat Aug 29, 2020 3:18 pm
by bitfogav
garryp4 wrote:
Sat Aug 29, 2020 2:16 pm
Any updates go to the c:\ProgramData\Mecanique|Swordfish\Library so it seems Swordfish should look there first, then the working directory. Otherwise the libraries will not be current.
Any Compiler update will update the default libraries in C:\ProgramData\Mecanique|Swordfish\Library, but if you have a copy of any of the
default libraries in the location of C:\Users\<Name>\Documents\Swordfish\UserLibrary then these will over ride the compiler default libraries..
Compiler will search for modules in the following order..

(a) in the folder that contains the main program
(b) the user library folder
(c) the system library folder


https://www.sfcompiler.co.uk/phpBB3/vie ... arch#p9070

Re: Problem with the path to the Library folder

Posted: Tue Sep 01, 2020 4:14 pm
by garryp4
There in lies a problem. The updates go tot the c:\ProgramData\Mecanique|Swordfish\Library directory and Swordfish looks first in c:\users\g\documents\swordfish\userlibrary, missing the updated modules.

And why does Swordfish keep creating the c:\users\g\documents\swordfish\userlibrary directory after I delete it? I also set up Swordfish on a completely wiped desktop and the c:\users\g\documents\swordfish\userlibrary directory does not exist, so it apparently is not needed. However I can not keep it off my laptop as it is recreated every time Swordfish starts.

Re: Problem with the path to the Library folder

Posted: Tue Sep 01, 2020 4:27 pm
by Jerry Messina
Putting files into the userlibrary allows you to override what's in the standard library folder.
If you want to use the standard copy, get rid of the one in userlibrary.

The installer doesn't touch what's in the userlibrary... you wouldn't want it to delete modules you may have changed.
That does mean that your userlibary copy won't get any updates applied to it, but that's something you'd have to manage yourself.

Re: Problem with the path to the Library folder

Posted: Tue Sep 01, 2020 4:42 pm
by garryp4
I delete the complete user Swordfish directory, close explorer then reopen to verify the directory is still gone. Then I launch Swordfish and the user directory is re-created. I can duplicate this every time. I went so far as wiping Swordfish and the user directory off the system. I even did a search of the registry for any mention of 'swordfish'. Then re-installed swordfish, and get the same thing. Every time. However it does not happen on the new system. a bit perplexing.

Re: Problem with the path to the Library folder

Posted: Tue Sep 01, 2020 5:05 pm
by Jerry Messina
If you were to delete the two folders:
c:\users\g\documents\swordfish\userlibrary
C:\ProgramData\Mecanique\Swordfish\userlibrary

then I don't know where in the world it could pull a copy from!

Re: Problem with the path to the Library folder

Posted: Wed Sep 02, 2020 7:16 am
by David Barker
You could try enabling "VIEW...EDITOR OPTIONS" -> "Display Full Filename in Application Title Bar" to see where any file is located.

Re: Problem with the path to the Library folder

Posted: Fri Sep 04, 2020 4:49 pm
by garryp4
I uninstalled both Swordfish and Firewing from the laptop system. Then I deleted C:\ProgramData\Mecanique. Then I deleted c:\users\g\documents\swordfish. Then I deleted c:\ProgramFiles\mecanique. There should have been no reference to Swordfish or Firewing left on the system. The I installed the current rev of Swordfish. The C:\ProgramData\Mecanique\Swordfish\userlibrary was created during the install but the c:\users\g\documents\swordfish\userlibrary still did not exist. As soon as I launched Swordfish, c:\users\g\documents\swordfish\userlibrary was recreated.

David: I do keep the file path visible in the Title Bar. It is what led me to finding why I was having problems with using old module versions. Now that I understand what is happening, I can work around it. I'm trying to figure out why one system work different than another with the same Swordfish rev and both running Windows 10.

Thanks,
Garry

Re: Problem with the path to the Library folder

Posted: Sat Sep 05, 2020 8:30 am
by David Barker
You have described the correct behaviour for an install

> c:\users\g\documents\swordfish\userlibrary still did not exist

An operating system may have multiple accounts. So when the application is first run it creates a unique copy of certain directories to ensure that if any changes are made by an individual user, it does not impact other accounts. The private "documents" area is created at runtime from the contents of the public "all users" folder created at install time.

Re: Problem with the path to the Library folder

Posted: Wed Dec 16, 2020 11:20 pm
by garryp4
David:
I think there is still an issue with the hierarchy of the selected folder. First should be the root folder the current working .bas file is in. Second should be the c:\ProgramData\Mecanique\Swordfish\Library so as those files get updated, the newest one is used.

I am currently writing a new program and did an include to strings.bas. The IDE somehow found a copy dated 2006 from a directory I was using back then. I tried coping the current version from 2019 into my working directory and it still links to the 2006 version.

Other than coping the 2019 version into the old 2006 directory, how can I use it?

Thanks,
Garry

Re: Problem with the path to the Library folder

Posted: Thu Dec 17, 2020 7:43 am
by David Barker
The priority is:

(1) folder that contains the main program you are compiling

then

(2) swordfish user library

then

(3) swordfish standard library

it has always been like that - no changes have been made to include lookup priorities

Re: Problem with the path to the Library folder

Posted: Thu Dec 17, 2020 6:47 pm
by Jerry Messina
The IDE somehow found a copy dated 2006 from a directory I was using back then. I tried coping the current version from 2019 into my working directory and it still links to the 2006 version.
If you look in the project .idf file, the second section (.file) includes a list of all the included files along with their path.

On thing that's maybe not obvious in the priority list is that when a folder is searched, any sub-folders under that path are also searched.
So, if you have sub-folders under your project directory (1), they'll get searched too before moving on to (2) and its subfloders and then to (3) and its subfolders.