Skip to content

Commit

Permalink
fix: 调整音乐文件目录
Browse files Browse the repository at this point in the history
调整音乐文件缓存目录

Log: 只启动一个音乐
  • Loading branch information
wyu71 authored and lzwind committed Mar 24, 2022
1 parent 550366b commit 439380b
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/music-player/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ int main(int argc, char *argv[])
}
}

if (!app->setSingleInstance("deepinmusic") || !checkOnly()) {
if (!app->setSingleInstance("deepinmusic") || !bc) {
qDebug() << "another deepin music has started";
QDBusInterface speechbus("org.mpris.MediaPlayer2.DeepinMusic",
"/org/mpris/speech",
Expand Down Expand Up @@ -175,21 +175,15 @@ int main(int argc, char *argv[])
bool checkOnly()
{
//single
QString userName = QDir::homePath().section("/", -1, -1);
std::string path;
if (userName == "root") {
path = "/tmp/deepin-music/";
} else {
path = ("/home/" + userName + "/.cache/deepin/deepin-music/").toStdString();
}
QDir tdir(path.c_str());
QString path = DStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
QDir tdir(path);
if (!tdir.exists()) {
bool ret = tdir.mkpath(path.c_str());
qDebug() << ret ;
bool ret = tdir.mkpath(path);
qDebug() << __func__ << ret ;
}

path += "single";
int fd = open(path.c_str(), O_WRONLY | O_CREAT, 0644);
path += "/single";
int fd = open(path.toLocal8Bit().toStdString().c_str(), O_WRONLY | O_CREAT, 0644);
int flock = lockf(fd, F_TLOCK, 0);

if (fd == -1) {
Expand Down

0 comments on commit 439380b

Please sign in to comment.