qt - Get path of file in external library -
i have 2 qt projects i've made. 1 builds library other builds gui uses library. project library includes bunch of shaders i've made. within gui want reference path these shaders. approach have static function in library called getlibrarypath() returns qstring referencing path on file system library.
i've tried using qdir::currentpath() , qapplication::applicationfilepath() , other similar functions return paths return paths referencing gui's path, not library's path though function path located inside library.
within gui try reference shader doing: shader->addshaderfromsourcefile(qglshader::vertex, myexternallib::getlibrarypath() + "/shaders/myvertexshader.vs");
a library bunch of code. has no notion of having own path. normal way of doing intend is:
if library separately installed product -- set registry entry in installer, , check @ runtime. platform specific, unless library written in qt -- can use qsettings, make sure set company name, application, etc. appropriately it's not done qapplication anymore.
if library installed part of application, in same folder tree: use
qcoreapplication::applicationdirpath(), add relative path between application executable , files want path.
Comments
Post a Comment