LineGroup.csv is not readable

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
RussG
Posts: 124
Joined: Wed Apr 27, 2022 11:27 pm

Re: LineGroup.csv is not readable

Post by RussG »

adrianinsaval wrote: Mon Aug 08, 2022 3:54 pm I don't use mac so I'm sorry if this is a stupid question, but doesn't this path (/Applications/FreeCAD.app/Contents/Resources/share/Mod/TechDraw/LineGroup/LineGroup.csv) stop existing if you change the name of the app?
If so then as soon as you change the name of the app the preference setting is not correct anymore so you would have to adjust to the new name you gave it.
I don't think yours is a stupid question at all. The answer is no. Changing the name of the app did not change the path in the Prefs at all. To expand on that, originally I had FreeCAD .19. On the Mac the file shows as "FreeCAD.app". Recently I downloaded .20. I renamed each copy of the app to reflect which version it was "FreeCAD .19.app" and "FreeCAD .20.app" respectively. When opening either of the renamed apps and checking the path to the LineGroup.csv file, the Prefs panel was populated with the same and correct path to the csv file. Not only was the Prefs file populated with the path, but a manual inspection of the path proved it to be correct and that the csv file existed. I also opened the csv file with a text editor without incident which might have been some indication it was not corrupted. As I wrote previously, the error message disappeared when renaming the apps back to FreeCAD.app.

I believe I may recall other instances of changing an application's name that resulted in problems using the app, but that this is not always the case. Also, on the Mac, if a person single clicks on an app's icon then invokes the Get Info command with the key combination Command-I the Get Info window will open (screenshot attached). You will notice in the Get Info window that versioning information for FreeCAD is absent. Now I'm not sure what that means as to how the operating system deals with it, but generally the Get Info window does include version numbers. FWIW, neither version of FreeCAD I have includes versioning info in the Get Info window. When I change an app's name that change is reflected in the Name & Extension field of the Get Info window. It seems the Mac regards an app's name as separate from its version, and perhaps it also regards the name the users sees or changes it to as yet something different from how the OS identifies the app. This is above my pay grade, however.
Get Info.jpg
Get Info.jpg (30.7 KiB) Viewed 1156 times
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: LineGroup.csv is not readable

Post by adrianinsaval »

RussG wrote: Mon Aug 08, 2022 4:32 pm I don't think yours is a stupid question at all. The answer is no. Changing the name of the app did not change the path in the Prefs at all.
I know the preference didn't change, what I'm saying is that since the preference stays the same and you have changed the real path then it is natural that it would raise an error.
RussG wrote: Mon Aug 08, 2022 4:32 pm Not only was the Prefs file populated with the path, but a manual inspection of the path proved it to be correct and that the csv file existed.
here I am confused again, with what path it was populated? If it's still the same path as before how could it exist if you had renamed it?

The issue I see here is that this preference should not be populated unless the user specifically sets it.
RussG
Posts: 124
Joined: Wed Apr 27, 2022 11:27 pm

Re: LineGroup.csv is not readable

Post by RussG »

adrianinsaval wrote: Mon Aug 08, 2022 4:39 pm
RussG wrote: Mon Aug 08, 2022 4:32 pm I don't think yours is a stupid question at all. The answer is no. Changing the name of the app did not change the path in the Prefs at all.
I know the preference didn't change, what I'm saying is that since the preference stays the same and you have changed the real path then it is natural that it would raise an error.
RussG wrote: Mon Aug 08, 2022 4:32 pm Not only was the Prefs file populated with the path, but a manual inspection of the path proved it to be correct and that the csv file existed.
here I am confused again, with what path it was populated? If it's still the same path as before how could it exist if you had renamed it?

The issue I see here is that this preference should not be populated unless the user specifically sets it.
OK, I think I'm finally seeing that if I change the name of the app I must also change the name of the app in the paths of the prefs window, and that even though FreeCAD initially self-populates the paths in the prefs it does not self-update those paths should the user change the file name of the app.

If I change the app name and also update the paths in the prefs window to reflect that new app name then there is no error. Where I got tripped up was expecting FreeCAD to use the same path after changing the name of the app or to self-update the path in prefs. I didn't understand that I would need to update the path in the prefs to reflect the new app name. I wasn't smart enough to realize that would need to be done, but then, neither was FreeCAD. LOL

I was initially a little thrown off in your most recent post where you wrote "...since the preference stays the same and you have changed the real path then ..." At first I took you to mean changing the path in the prefs, but now I'm thinking what you meant is that by changing the name of the app I changed the path. Is that right? That rather important tidbit of info was absent.

I was similarly confused where you wrote "If it's still the same path as before how could it exist if you had renamed it?" No matter how many times I read that my reaction remains "Huh? What". Hahah. No worries though, I think it's all good now thanks to your help and that of the other contributors.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: LineGroup.csv is not readable

Post by adrianinsaval »

RussG wrote: Mon Aug 08, 2022 7:40 pm but then, neither was FreeCAD. LOL
Yes and IMO adding code to auto update some obscure preference in some edge case is not worth it, but FreeCAD shouldn't save this as a preference to begin with unless the user manually specifies it, @wandererfan what do you think of this? why is path that is dependent on the installation saved as a preference?
RussG
Posts: 124
Joined: Wed Apr 27, 2022 11:27 pm

Re: LineGroup.csv is not readable

Post by RussG »

adrianinsaval wrote: Mon Aug 08, 2022 9:03 pm
RussG wrote: Mon Aug 08, 2022 7:40 pm but then, neither was FreeCAD. LOL
Yes and IMO adding code to auto update some obscure preference in some edge case is not worth it, but FreeCAD shouldn't save this as a preference to begin with unless the user manually specifies it, @wandererfan what do you think of this? why is path that is dependent on the installation saved as a preference?
I'm not a programmer. I'm a user. Certainly not a super-user, and with FreeCAD I'm a relative newcomer. From that perspective I would say I like that FreeCAD self-populated the paths in prefs. I don't think I would ask that the prefs auto update based on a user changing the name of the app...that would not seem worth the code, but I do think FreeCAD should save the prefs for the user based on the app installation because asking a user to specify these things is more than many users including myself would initially be capable of doing. If I had to set all that up when I first installed FreeCAD I don't think I would have made it to day two of using the app.

Part of this is that on the Mac the path to the prefs is initially invisible, at least in more modern versions of the OS. The user has no clear cut way to navigate to the various prefs directories. For example /Applications/FreeCAD.app/Contents/Resources/share/Mod/TechDraw/LineGroup/LineGroup.csv is not something the user can see directly and it requires jumping through some hoops that are somewhat obscure. The immediately visible path ends after /Applications/FreeCAD.app. To go any deeper into the directory structure the user must control click on the app and select Show Package Contents. This is not the normal way of navigating the directory structure on a Mac nor one that I would posit most Mac users are acquainted with. Even after invoking the command that makes normally invisible system files and directories visible I could find no way to navigate the path to the LineGroup.csv file. The only way I have been able to get to it is to control-click on the app, select Show Package Contents, and only then is the directory structure visible. I don't think very many Mac users are accustomed to this. I wasn't. I may be missing something, but so far it seems that's the only way to get there. As a Mac user of many years I can say that dealing with prefs files is rather under-the-hood and foreign to Mac users. Setting prefs is one thing, but navigating the directory structure and designating where prefs should be kept takes people into the dark recesses of the Mac user experience and just isn't someplace Mac users at large tend to dwell. My 2¢.
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: LineGroup.csv is not readable

Post by wandererfan »

adrianinsaval wrote: Mon Aug 08, 2022 9:03 pm why is path that is dependent on the installation saved as a preference?
Not sure I understand the question. If the preference refers to a file that is part of the installation (like templates or linegroup) then it must be dependent on the installation.

Unless the mac build is radically different, file preferences are not self-populated any more. There was a time that blank file preferences were filled with a default value, but that caused problems and was removed before v0.20 was released.

The preferences dialogs save what ever is in the file choosers on the screen to user.cfg. They load what ever is in user.cfg to the file choosers. If there is no entry in user.cfg for a preference, then it is blank on the screen. If the file chooser is filled, then there was an entry in user.cfg.

I don't know where user.cfg would be on a mac. On linux user.cfg is saved outside the installation directories.
RussG
Posts: 124
Joined: Wed Apr 27, 2022 11:27 pm

Re: LineGroup.csv is not readable

Post by RussG »

wandererfan wrote: Mon Aug 08, 2022 11:57 pm
adrianinsaval wrote: Mon Aug 08, 2022 9:03 pm why is path that is dependent on the installation saved as a preference?
Not sure I understand the question. If the preference refers to a file that is part of the installation (like templates or linegroup) then it must be dependent on the installation.

Unless the mac build is radically different, file preferences are not self-populated any more. There was a time that blank file preferences were filled with a default value, but that caused problems and was removed before v0.20 was released.

The preferences dialogs save what ever is in the file choosers on the screen to user.cfg. They load what ever is in user.cfg to the file choosers. If there is no entry in user.cfg for a preference, then it is blank on the screen. If the file chooser is filled, then there was an entry in user.cfg.

I don't know where user.cfg would be on a mac. On linux user.cfg is saved outside the installation directories.
I'm not sure if this will help clarify...I started with FreeCAD .19 on the Mac a few months ago. Very recently I upgraded to .20. I think it was after the upgrade, but I'm not certain, that I installed the TechDraw WB. Whether it was with v.19 of v.20 TechDraw was a recent addition.

When I go to the TechDraw Prefs there are 6 paths listed in the Files section of the General tab. All of these file paths were populated by FreeCAD, not me. (Screenshot below.)

User.cfg is not in the Mac vernacular as far as I know. How Apple has organized the OS has changed over time. I'm relatively knew to Big Sur (macOS 11.6.7) and it appears to store prefs files differently than El Capitan (Mac OS 10.11.6 or so and the previous OS I was using).
TechDraw Prefs.jpg
TechDraw Prefs.jpg (76.71 KiB) Viewed 928 times
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: LineGroup.csv is not readable

Post by wandererfan »

RussG wrote: Tue Aug 09, 2022 12:30 am When I go to the TechDraw Prefs there are 6 paths listed in the Files section of the General tab. All of these file paths were populated by FreeCAD, not me. (Screenshot below.)
Ah-hah! :idea:
v0.19 used to populate blank file preferences with the default. v0.20 does not. If v0.20 uses the same user.cfg that was created by v0.19, then that would explain a lot.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: LineGroup.csv is not readable

Post by adrianinsaval »

wandererfan wrote: Mon Aug 08, 2022 11:57 pm The preferences dialogs save what ever is in the file choosers on the screen to user.cfg. They load what ever is in user.cfg to the file choosers. If there is no entry in user.cfg for a preference, then it is blank on the screen. If the file chooser is filled, then there was an entry in user.cfg.
could you point me to where in the code this happens or what commit changed this behavior? There's a parameter that I think has the same issue and I'd like to solve it.
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: LineGroup.csv is not readable

Post by wandererfan »

adrianinsaval wrote: Tue Aug 09, 2022 10:23 pm could you point me to where in the code this happens or what commit changed this behavior? There's a parameter that I think has the same issue and I'd like to solve it.
Try git commit 2b0dd54fe7 and src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp.
Post Reply