Open ghost opened 4 years ago
Hi, can you make a PR ? thanks! Or can you copy/paste the good lines for linux and std::string MainWindow::get_glass_path() const ?
By the way does Astree launch in full screen correctly?
Or can you copy/paste the good lines for linux and
std::string MainWindow::get_glass_path() const
?
As I can see in initially @probonopd proposed to use ../share/astree/glass/
, but actual path (... sAppPath + "/../share/astree/glass/" ...
) include one extra /
as first path character; think, this extra /
should be removed.
By the way does Astree launch in full screen correctly?
NO! Yeah, there is issue with fullscreen too.
I suggest issue exits with size of some widgets, because I can't maximize window until move/reorder few widgets on left pane.
I hope path issue now fixed, but can't verify it just now so will test builds later today.
If all would be OK I will close this issue.
thanks
UPD: Last fix does NOT help; not solved yet.
Need deeper review internal AppImage structure and glass
folder path.
thanks anyway !
So you have
appdir/usr/bin/astree
appdir/usr/share/astree/glass
Correct?
Then it should work... what does QCoreApplication::applicationDirPath()
return?
So you have
appdir/usr/bin/astree appdir/usr/share/astree/glass
Check actual AppImage build:
If extract it, paths looks next:
$ ./Astree-dc626b8-x86_64.AppImage --appimage-extract
squashfs-root/.DirIcon
squashfs-root/AppRun
squashfs-root/astree.desktop
squashfs-root/astree.svg
squashfs-root/usr
squashfs-root/usr/bin
squashfs-root/usr/bin/astree
...
squashfs-root/usr/glass
...
squashfs-root/usr/glass
looks wrong to me, should be squashfs-root/usr/share/glass
?
Since this might break AppImage again, and I'm not certain this is optimal, I'm not doing a pull request. However, I made the following changes to get non-AppImage Astree Glass Catalogue to work in Linux: `$ git diff *cpp diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 675c7ea..d78598f 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -3,7 +3,8 @@ // copyright Etienne de Foras ( the author ) mailto: etienne.deforas@gmail.com
-
+#include
@@ -46,9 +47,10 @@ MainWindow::MainWindow(QWidget parent)
//load all glass catalog
string sGlassPath = get_glass_path();
vector
bool bOk=GlassCatalogIO::load(vsCatalog[i],GlassManager::singleton()); if(bOk==false) QMessageBox::warning(this,"Warning:","Unable to load glass catalog: "+QString(vsCatalog[i].c_str())); } @@ -399,7 +401,7 @@ std::string MainWindow::get_glass_path() const
string sAppPath = QCoreApplication::applicationDirPath().toStdString();
` Basically the strings in the vsCatalog vector of strings already has sGlassPath so it shouldn't be added again when loading the catalog files. And sAppPath doesn't end in "/" so I added one to sGlassPath.
The makefile didn't install the catalogs so I copied them by hand to /usr/share/astree/glass.
It might be better to use QStandardPaths::AppDataLocation, QStandardPaths::AppLocalDataLocation, or even QStandardPaths::AppConfigLocation so you don't have to worry about where to put stuff for each OS. I don't know anything about AppImage except I use some that store stuff in those locations on the regular hard drive, FreeCad for instance.
Indeed:
If an application is relying on QStringList QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
the XDG_DATA_DIRS
environment variable must be exported to <inside the AppDir>/usr/share/
in the AppDir by AppRun. (Note that linuxdeployqt
does not use an AppRun
file, just a symlink, and as a result this does not work there.)
As a fallback, you can use QString QCoreApplication::applicationDirPath()
instead and construct a relative path to the application's data files from there.
For an example, see: https://github.com/KaidanIM/Kaidan/commit/da38011b55a1aa5d17764647ecd699deb4be437f
As a result, it should work both in normal installations and in relocatable installations such as AppImages.
Source: https://github.com/AppImage/AppImageKit/wiki/Bundling-Qt-apps
Hello thanks for the PR! So, agree to merge ?
I try to use AppImage builds, but seems like there are some issues with glass catalog path.
Actually, according
../src/gui/MainWindow.cpp
, Astree use next path forsGlassPath
:Inside AppImage (if extract it as
$ ./Astree*.AppImage --appimage-extract
) there is/glass/
catalog, but its path looks next:So, if I run AppImage build Astree recognize only built-in materials (
Air
;Vacuum
;Water
).As result, on opening
Newton_BK7_diagonals.astree
sampleBK7
could not be loaded from../glass/common_glass.agf
: "Glass BK7 doesn't exist in catalog!"