Skip to content

Commit 4972d1a

Browse files
committed
fix build
1 parent 4ea65f6 commit 4972d1a

15 files changed

+249
-101
lines changed

SharpsenBox/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+

2+
build

SharpsenBox/.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"filesystem": "cpp"
4+
}
5+
}

SharpsenBox/CmakeModules/Config.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
44
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
55
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
66
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
7+
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
8+
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
79

810
option(AUTO_QT_LIBS "Runs Qt ulility program to automaticly add qt/qml libraries to bin folder" OFF)
911
option(BUILD_TESTS "Build tests" OFF)
@@ -76,10 +78,8 @@ set(pages ${CMAKE_SOURCE_DIR}/Gui)
7678
file( COPY ${totalPath}/SharpsenBoxInfo.json ${totalPath}/Games.json DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Config )
7779
file( COPY ${pages}/ExampleOne.qml ${pages}/ExampleTwo.qml DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Pages )
7880

79-
set(UpdaterPath Updater)
81+
set(SharpsenBoxPath ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../SharpsenBox)
8082

81-
set(SharpsenBoxPath SharpsenBox)
83+
set(PatherPath ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Pather)
8284

83-
set(PatherPath Pather)
84-
85-
set(TestPath Tests)
85+
set(TestPath ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Tests)

SharpsenBox/Source/App/QGameManager/GameManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ namespace gm {
119119
}
120120

121121
Q_INVOKABLE void GameManager::checkAutoUpdate(int id) {
122-
auto& game = bc::Component <cf::IConfig>::get().getGame(id);
122+
auto& game = bc::Component<cf::IConfig>::get().getGame(id);
123123
if (game.autoCheck && game.installed) {
124124
if (lock_) {
125125
auto& dialog = bc::Component<dl::IDialog>::get();
126126
dialog.setType(dl::IDialog::INFO);
127-
dialog.setInfo(QString("Cannot auto update game ") + game.name + "another process is running");
127+
dialog.setInfo(QString("Cannot auto update game ") + game.name + " another process is running");
128128
dialog.show();
129129
} else {
130130
lock();

SharpsenBox/Source/AppLauncher/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ public class Program
88
{
99
public static void Main(string[] args)
1010
{
11+
var processName = System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location);
12+
// if instance of program is already running return;
13+
if (System.Diagnostics.Process.GetProcessesByName(processName).Count() > 1)
14+
return;
15+
1116
Directory.SetCurrentDirectory("./Updater");
1217
var updater = new ProcessStartInfo
1318
{

SharpsenBox/Source/QConfig/Config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace cf {
3333
if (!std::filesystem::exists(getConfigJson()))
3434
;//problem
3535
QString val = readJsonFile(getConfigJson().generic_string().c_str());
36-
auto& ff = val.toStdString();
36+
auto ff = val.toStdString();
3737
QJsonDocument d = QJsonDocument::fromJson(val.toUtf8());
3838

3939
// Read settings
@@ -160,9 +160,9 @@ namespace cf {
160160
std::filesystem::path path = getenv("PROGRAMFILES");
161161
return QUrl::fromLocalFile(path.generic_string().c_str());
162162
} else { //mac /linux
163-
return "";
163+
return QString();
164164
}
165-
return "";
165+
return QString();
166166
}
167167

168168

SharpsenBox/Source/UpdateManager/AppInfoParser.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ namespace im {
1616
file.setFileName(path.generic_string().c_str());
1717
file.open(QIODevice::ReadOnly | QIODevice::Text);
1818
val = file.readAll();
19-
auto& ghj = val.toStdString();
19+
auto ghj = val.toStdString();
2020
file.close();
2121
QJsonDocument d = QJsonDocument::fromJson(val.toUtf8());
2222

2323
versionToUpdate_ = d["Ver"].toString();
2424
auto& actualVersion = updateInfo_->getActualVersion();
2525

26-
auto& tt = actualVersion.toStdString();
27-
auto& gg = versionToUpdate_.toStdString();
26+
auto tt = actualVersion.toStdString();
27+
auto gg = versionToUpdate_.toStdString();
2828

2929
auto fileListUrl = d["FileList"].toString();
3030
pathFiles_.push_back({ fileListUrl.toStdString(), "FileList.json" });
@@ -42,9 +42,9 @@ namespace im {
4242
error("Unexpected error ocured while reading update file");
4343
}
4444
}
45-
void AppInfoParser::getPathUrls(QJsonObject& pathList) {
45+
void AppInfoParser::getPathUrls(const QJsonObject& pathList) {
4646
for (auto it = pathList.begin(); it != pathList.end(); it++) {
47-
auto& ff = it.key().toStdString();
47+
auto ff = it.key().toStdString();
4848
auto& actualVer = updateInfo_->getActualVersion();
4949
if (it.key() <= actualVer)
5050
continue;

SharpsenBox/Source/UpdateManager/AppInfoParser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace im {
2424
void run() override;
2525
void reset() override;
2626
private:
27-
void getPathUrls(QJsonObject& pathList);
27+
void getPathUrls(const QJsonObject& pathList);
2828

2929
QString versionToUpdate_;
3030
std::filesystem::path parseInfoFileName = "AppInfo.json";

SharpsenBox/Source/UpdateManager/ArchieveInstaller.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ namespace im {
3636
std::string getErrorStr(int code);
3737
void emitStatus();
3838

39-
static int64_t readFile(archive* a, void* client_data, const void** buff);
40-
static int ArchieveInstaller::closeFile(archive* a, void* client_data);
39+
static SSIZE_T readFile(archive* a, void* client_data, const void** buff);
40+
static int closeFile(archive* a, void* client_data);
4141

4242
std::filesystem::path destinationDir_;
4343
std::ifstream file;

SharpsenBox/Source/UpdateManager/Downloader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ namespace im {
105105
auto& files = updateInfo_->getFiles();
106106
auto size = files.size();
107107
for (size_t i = 0; !cancelled && i < size; i++) {
108-
auto& url = files.at(i).url.generic_string();
108+
auto url = files.at(i).url.generic_string();
109109
auto& filename = files.at(i).fileName;
110110
lastDownload_ = 0;
111111
outfile_ = (downloadDir / filename).generic_string();

SharpsenBox/Source/UpdateManager/FileListParser.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ namespace im {
1919
file.setFileName(path.generic_string().c_str());
2020
file.open(QIODevice::ReadOnly | QIODevice::Text);
2121
val = file.readAll();
22-
auto& ghj = val.toStdString();
22+
auto ghj = val.toStdString();
2323
file.close();
2424
fileList_ = QJsonDocument::fromJson(val.toUtf8());
2525
QString ver = fileList_["Ver"].toString();
2626

27-
auto& ss = ver.toStdString();
27+
auto ss = ver.toStdString();
2828
if (false /*ver != toUpdateVersion_ */) { //need update
2929
//todo error
3030
} else if (updateInfo_->getFullInstall()) {
@@ -40,7 +40,7 @@ namespace im {
4040
void FileListParser::readPackets() {
4141
auto& pathFiles = updateInfo_->getFiles(); // path files 1st is file list so skip it
4242
auto it = pathFiles.begin();
43-
auto& fileList = fileList_["Files"].toObject();
43+
auto fileList = fileList_["Files"].toObject();
4444
for (++it; it != pathFiles.end(); it++) {
4545
QString val;
4646
QFile file;
@@ -49,14 +49,14 @@ namespace im {
4949
file.setFileName(path.generic_string().c_str());
5050
file.open(QIODevice::ReadOnly | QIODevice::Text);
5151
val = file.readAll();
52-
auto& ghj = val.toStdString();
52+
auto ghj = val.toStdString();
5353
file.close();
5454
QJsonDocument d = QJsonDocument::fromJson(val.toUtf8());
5555
auto changed = d["ChangedFiles"].toArray();
5656
auto removed = d["RemovedFiles"].toArray();
5757
auto added = d["AddedFiles"].toArray();
5858
// remove
59-
for (auto& rem : removed) {
59+
for (auto rem : removed) {
6060
auto str = rem.toString();
6161
auto found = toDownload_.find(str);
6262
if (found != toDownload_.end()) {
@@ -67,12 +67,12 @@ namespace im {
6767
}
6868

6969
// add
70-
for (auto& chan : changed) {
70+
for (auto chan : changed) {
7171
auto str = chan.toString();
7272
toDownload_.insert(str);
7373
}
7474

75-
for (auto& add : added) {
75+
for (auto add : added) {
7676
auto str = add.toString();
7777
toDownload_.insert(str);
7878
}
@@ -82,7 +82,7 @@ namespace im {
8282
std::unordered_map<std::string, std::string> neededPackets;
8383
for (auto& file : toDownload_) {
8484
auto elem = fileList[file].toObject();
85-
auto& pack = packets[elem["Id"].toString()].toObject();
85+
auto pack = packets[elem["Id"].toString()].toObject();
8686
if (!neededPackets.contains(pack["Url"].toString().toStdString())) {
8787
totalBytesTo_ += std::stoll(pack["Size"].toString().toStdString());
8888
neededPackets.insert({ pack["Url"].toString().toStdString(), pack["Name"].toString().toStdString() });
@@ -96,8 +96,8 @@ namespace im {
9696

9797
void FileListParser::readAllPackets() {
9898
auto packets = fileList_["Packets"].toObject();
99-
for (auto& pac : packets) {
100-
auto& pack = pac.toObject();
99+
for (auto pac : packets) {
100+
auto pack = pac.toObject();
101101
auto tt = pack["Url"].toString().toStdString();
102102
auto sizeStr = pack["Size"].toString().toStdString();
103103
totalBytesTo_ += std::stoll(sizeStr);

SharpsenBox/Source/UpdateManager/GameParser.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ namespace im {
1414
QFile file;
1515
//open SharpsenBoxConfig file
1616
auto& config = bc::Component<cf::IConfig>::get();
17-
auto& path = config.getDownloadDir() / "Games.json";
17+
auto path = config.getDownloadDir() / "Games.json";
1818
file.setFileName(path.generic_string().c_str());
1919
file.open(QIODevice::ReadOnly | QIODevice::Text);
2020
val = file.readAll();
21-
auto& ghj = val.toStdString();
21+
auto ghj = val.toStdString();
2222
file.close();
2323
QJsonDocument d = QJsonDocument::fromJson(val.toUtf8());
24-
for (auto& game : d.object()) {
25-
auto& gameObject = game.toObject();
24+
for (auto game : d.object()) {
25+
auto gameObject = game.toObject();
2626
auto id = std::stoi(gameObject["Id"].toString().toStdString());
2727
if (!config.gameExists(id)) {
2828
//create new
@@ -40,13 +40,13 @@ namespace im {
4040
config.insertGame(game);
4141
}
4242
auto& hadGame = config.getGame(id);
43-
auto& presetationVer = gameObject["PresentationVer"].toString();
43+
auto presetationVer = gameObject["PresentationVer"].toString();
4444
hadGame.presentationUrl = gameObject["PresentationUrl"].toString();
45-
auto& ff = hadGame.PresentationVer.toStdString();
46-
auto& ss = presetationVer.toStdString();
45+
auto ff = hadGame.PresentationVer.toStdString();
46+
auto ss = presetationVer.toStdString();
4747
if (hadGame.presentationUrl.isEmpty() && hadGame.PresentationVer != presetationVer) {
48-
auto& url = gameObject["PresentationPackUrl"].toString().toStdString();
49-
auto& fileName = hadGame.name.toStdString() + ".zip";
48+
auto url = gameObject["PresentationPackUrl"].toString().toStdString();
49+
auto fileName = hadGame.name.toStdString() + ".zip";
5050
std::filesystem::path destination = config.gamePageDir(id);
5151
files_.push_back({ url, fileName , destination });
5252
toUpdate_.push_back({ id, presetationVer });

SharpsenBox/Source/UpdateManager/UpdateManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ namespace im {
162162
setTotal(0);
163163
updateInfo_->setUpdateMode(UpdateInfo::UpdateMode::GAME);
164164
updateInfo_->setActualGame(game);
165-
auto& gg = game.appInfoUrl.toStdString();
165+
auto gg = game.appInfoUrl.toStdString();
166166
auto& actualGame = updateInfo_->getActualGame();
167167
actualGame.gameDir = gamePath;
168168
actualGame.shortcut = shortcut;

SharpsenBox/conanfile.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[requires]
2-
libcurl/7.52.1@bincrafters/stable
2+
libcurl/7.76.0
33
zlib/1.2.11@conan/stable
44
libarchive/3.4.0
5-
gtest/1.8.0@bincrafters/stable
5+
gtest/1.10.0
66

77
[generators]
88
cmake

0 commit comments

Comments
 (0)