File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,27 @@ bool fileExists(QString path) {
3838 return check_file.exists () && check_file.isFile ();
3939}
4040
41+ void rmDir (QString dirName) {
42+ QDir dir;
43+ QDir statsDir (dirName);
44+
45+ if (dir.exists (dirName)) {
46+ statsDir.removeRecursively ();
47+ }
48+ }
49+
50+ void mkDir (QString dirName, bool setPermissions) {
51+ QDir dir;
52+
53+ if (dir.exists (dirName) || !dir.mkdir (dirName) || !setPermissions) return ;
54+
55+ if (QFile::setPermissions (dirName, QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner)) {
56+ qDebug () << " Directory created successfully with 700 permissions." ;
57+ } else {
58+ qDebug () << " Failed to set permissions." ;
59+ }
60+ }
61+
4162QByteArray fileGetContents (QString path)
4263{
4364 QFile file (path);
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ QByteArray fileGetContents(QString path);
3838QByteArray fileOpen (QString path );
3939bool fileWrite (QString path , QString data );
4040QString getAccountName ();
41+ void mkDir (QString path , bool setPermissions = false);
42+ void rmDir (QString path );
4143#ifdef Q_OS_LINUX
4244QString xdgMime ();
4345void registerXdgMime ();
You can’t perform that action at this time.
0 commit comments