Skip to content

Commit

Permalink
exch:uavos#40 config versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
DashMok02 committed Mar 5, 2024
1 parent 28519db commit ac2f253
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib/ApxCore/App/AppBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ AppBase::AppBase(int &argc, char **argv, const QString &name)

QSettings::setDefaultFormat(QSettings::IniFormat);
//prefs
m_version = VERSION;
QDir prefs_dir(AppDirs::prefs());
if (!prefs_dir.exists())
prefs_dir.mkpath(".");
Expand All @@ -75,7 +76,7 @@ AppBase::AppBase(int &argc, char **argv, const QString &name)
QApplication::setWindowIcon(QIcon("qrc:///icons/uavos-logo.icns"));

// app constants
m_version = VERSION;

apxConsole() << tr("Version").append(":") << m_version;

m_hash = GIT_HASH;
Expand Down
13 changes: 12 additions & 1 deletion src/lib/ApxCore/App/AppDirs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "AppDirs.h"
#include "AppBase.h"

#include <app_def.h>

Expand Down Expand Up @@ -54,8 +56,17 @@ QDir AppDirs::user()
#ifdef __ANDROID__
return QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/.gcu");
#else
qsizetype macro_version = 0;
QString ver = AppBase::version();
for (qsizetype i = 0; i < ver.size(); ++i) {
if (ver.at(i) == ".") {
macro_version = i;
break;
}
}
ver.truncate(macro_version);
return QDir(QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))
.absoluteFilePath("UAVOS"));
.absoluteFilePath("UAVOS-" + ver));
#endif
}

Expand Down

0 comments on commit ac2f253

Please sign in to comment.