QuasarAppLib
qaplatformutils_linux.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024-2025 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8#include "qaplatformutils.h"
9
10#if defined(Q_OS_LINUX)
11#include <QDir>
12#include <QFileInfo>
13#include <QProcessEnvironment>
14#elif defined(Q_OS_ANDROID)
15#elif defined(Q_OS_WIN32)
16#elif defined(Q_OS_MACOS)
17#elif defined(Q_OS_IOS)
18#endif
19
20namespace QuasarAppUtils {
21
22#if defined(Q_OS_LINUX)
24 return QProcessEnvironment::systemEnvironment().value("SNAP").size();
25}
26
28 return "/var/lib/snapd/hostfs";
29}
30
33
35 return path;
36 }
37
38 if (path.size() && path[0] != QString("/")) {
39 auto absalutPath = QProcessEnvironment::systemEnvironment().value("PWD") + "/" + path;
40 if (!absalutPath.contains(snapRootFS())) {
41 return snapRootFS() + "/" + absalutPath;
42 }
43 }
44
45 if (!path.contains(snapRootFS())) {
46 return snapRootFS() + "/" + path;
47 }
48 }
49
50 return path;
51}
52
54 return QDir(snapRootFS()).entryList(QDir::AllEntries | QDir::NoDotAndDotDot).size();
55}
56
57#elif defined(Q_OS_ANDROID)
58
59bool PlatformUtils::isSnap() { return false;}
60
62
64
66
67#elif defined(Q_OS_WIN32)
68
69bool PlatformUtils::isSnap() { return false;}
70
72
74
76
77#elif defined(Q_OS_MACOS)
78
79bool PlatformUtils::isSnap() { return false;}
80
82
84
86
87#elif defined(Q_OS_IOS)
88
89bool PlatformUtils::isSnap() { return false;}
90
92
94
96
97#endif
98
99}
static QString snapRootFS()
snapRootFS returns root file system of main OS (available read only)
static bool isSnap()
isSnap This method check destribution type. true if the application packed as a snap.
static QString transportPathToSnapRoot(const QString &path)
transportPathToSnapRoot change path to snap avaialble.
static bool checkSystemBakupSnapInterface()
checkSystemBakupSnapInterface This method check access to bakcup permision of snap pacakge....
The QuasaraAppUtils class This lib include base functions for the all applications of QuasarApp group...
Definition helpdata.cpp:18
void gen(int size, QByteArray &result)