Switch to unified view

a/HelperStructs/Helper.cpp b/HelperStructs/Helper.cpp
...
...
121
121
122
    return final_str;
122
    return final_str;
123
123
124
}
124
}
125
125
126
#ifdef Q_OS_WIN
127
#include <Shlwapi.h>
128
#pragma comment(lib, "shlwapi.lib")
129
130
QString GetExecPath()
131
{
132
    TCHAR dest[MAX_PATH];
133
    DWORD length = GetModuleFileName(NULL, dest, MAX_PATH);
134
#ifdef NTDDI_WIN8_future
135
    PathCchRemoveFileSpec(dest, MAX_PATH);
136
#else
137
    PathRemoveFileSpec(dest);
138
#endif
139
    if (sizeof(TCHAR) == 2)
140
        return QString::fromUtf16((const ushort*)dest);
141
    else
142
        return QString::fromUtf8((const char*)dest);
143
}
144
#endif
145
126
QString Helper::getSharePath()
146
QString Helper::getSharePath()
127
{
147
{
128
    QString path;
148
    QString path;
129
#ifndef Q_OS_WIN
149
#ifndef Q_OS_WIN
130
    if (QFile::exists(PREFIX "/share/upplay")) {
150
    if (QFile::exists(PREFIX "/share/upplay")) {
131
        path = PREFIX "/share/upplay/";
151
        path = PREFIX "/share/upplay/";
132
    } else {
152
    } else {
133
        path = "";
153
        path = "";
134
    }
154
    }
135
#else
155
#else
136
    path = QDir::homePath() + QString("\\.upplay\\images\\");
156
    QDir execdir(GetExecPath());
137
    if (QFile::exists(path)) {
157
    QString rpath("Share");
138
        return path;
158
    execdir.mkpath(rpath);
139
    } else {
159
    path = execdir.absoluteFilePath(rpath);
140
        path = "";
141
    }
142
#endif
160
#endif
143
144
    return path;
161
    return path;
145
}
162
}
146
163
147
QString Helper::getIconPath()
164
QString Helper::getIconPath()
148
{
165
{
149
    return ":/icons/";
166
    return ":/icons/";
150
}
167
}
151
168
152
QString Helper::getHomeDataPath()
169
QString Helper::getHomeDataPath()
153
{
170
{
154
    QString mydatadir = QDir::homePath() + "/.local/share/upplay";
171
    QDir homedir(QDir::home());
155
    if (!QFile::exists(mydatadir)) {
172
156
        QDir().mkdir(mydatadir);
173
#ifndef Q_OS_WIN
157
    }
174
    QString rpath = QString::fromUtf8(".local/share/upplay");
158
    return mydatadir + "/";
175
#else
176
    QString rpath = QString::fromUtf8("AppData/Local/upplay/");
177
#endif
178
179
    homedir.mkpath(rpath);
180
    return homedir.absoluteFilePath(rpath);
159
}
181
}
160
182
161
QString Helper::get_cover_path(QString artist, QString album, QString extension)
183
QString Helper::get_cover_path(QString artist, QString album, QString extension)
162
{
184
{
163
    QString cover_dir = getHomeDataPath() + QDir::separator() + "covers";
185
    QString cover_dir = getHomeDataPath() + QDir::separator() + "covers";