-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REFAC(ipc): extract getRuntimeDir() for Socket and OverlayPipe
- Loading branch information
1 parent
694c973
commit d7dedfe
Showing
8 changed files
with
97 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2021-2022 The Mumble Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file at the root of the | ||
// Mumble source tree or at <https://www.mumble.info/LICENSE>. | ||
|
||
#ifndef MUMBLE_MUMBLE_IPCUTILS_H_ | ||
#define MUMBLE_MUMBLE_IPCUTILS_H_ | ||
|
||
#include <QtCore/QDir> | ||
|
||
namespace Mumble { | ||
|
||
/** | ||
* @returns The path where Mumble sets up MumbleOverlayPipe and MumbleSocket | ||
*/ | ||
QDir getRuntimeDir(void); | ||
|
||
}; // namespace Mumble | ||
|
||
#endif // MUMBLE_MUMBLE_IPCUTILS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2021-2022 The Mumble Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file at the root of the | ||
// Mumble source tree or at <https://www.mumble.info/LICENSE>. | ||
|
||
#include "IPCUtils.h" | ||
|
||
#include <unistd.h> | ||
#include <QtCore/QDir> | ||
#include <QtCore/QProcessEnvironment> | ||
#include <QtCore/QString> | ||
|
||
namespace Mumble { | ||
QDir getRuntimeDir(void) { | ||
QString xdgRuntimePath = QProcessEnvironment::systemEnvironment().value(QLatin1String("XDG_RUNTIME_DIR")); | ||
QString mumbleRuntimePath; | ||
if (!xdgRuntimePath.isNull()) { | ||
mumbleRuntimePath = QDir(xdgRuntimePath).absolutePath() + QLatin1String("/mumble/"); | ||
} else { | ||
mumbleRuntimePath = QLatin1String("/run/user/") + QString::number(getuid()) + QLatin1String("/mumble/"); | ||
} | ||
QDir mumbleRuntimeDir = QDir(mumbleRuntimePath); | ||
mumbleRuntimeDir.mkpath("."); | ||
return mumbleRuntimeDir; | ||
} | ||
|
||
}; // namespace Mumble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2021-2022 The Mumble Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file at the root of the | ||
// Mumble source tree or at <https://www.mumble.info/LICENSE>. | ||
|
||
#include "IPCUtils.h" | ||
|
||
#include <unistd.h> | ||
//#include <QtCore/QStandardPaths> | ||
#include <QtCore/QDir> | ||
|
||
namespace Mumble { | ||
QDir getRuntimeDir(void) { | ||
// QString runtimePath = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); // defaults to "~/Library/Application Support" | ||
// QDir mumbleRuntimeDir = QDir(runtimePath); | ||
QDir mumbleRuntimeDir = QDir::home(); | ||
return mumbleRuntimeDir; | ||
} | ||
|
||
}; // namespace Mumble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2021-2022 The Mumble Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file at the root of the | ||
// Mumble source tree or at <https://www.mumble.info/LICENSE>. | ||
|
||
#include "IPCUtils.h" | ||
|
||
#include <QtCore/QDir> | ||
#include <QtCore/QString> | ||
|
||
namespace Mumble { | ||
QDir getRuntimeDir(void) { | ||
QDir mumbleRuntimeDir = QDir::home(); | ||
return mumbleRuntimeDir; | ||
} | ||
|
||
}; // namespace Mumble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters