Small Fixes
This commit is contained in:
parent
8532e7707f
commit
2766611878
@ -1,5 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.16.0)
|
cmake_minimum_required(VERSION 3.16.0)
|
||||||
|
|
||||||
|
# Avoid Warning About DOWNLOAD_EXTRACT_TIMESTAMP
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24.0)
|
||||||
|
cmake_policy(SET CMP0135 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Build Mode
|
# Build Mode
|
||||||
set(MCPI_BUILD_MODE "native" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code")
|
set(MCPI_BUILD_MODE "native" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code")
|
||||||
set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "arm" "native")
|
set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "arm" "native")
|
||||||
|
@ -30,9 +30,6 @@ launcher_cache load_cache() {
|
|||||||
// Log
|
// Log
|
||||||
DEBUG("Loading Launcher Cache...");
|
DEBUG("Loading Launcher Cache...");
|
||||||
|
|
||||||
// Lock File
|
|
||||||
int lock_fd = lock_file(get_cache_path().c_str());
|
|
||||||
|
|
||||||
// Return Value
|
// Return Value
|
||||||
launcher_cache ret = empty_cache;
|
launcher_cache ret = empty_cache;
|
||||||
|
|
||||||
@ -46,6 +43,9 @@ launcher_cache load_cache() {
|
|||||||
WARN("Unable To Open Launcher Cache For Loading");
|
WARN("Unable To Open Launcher Cache For Loading");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Lock File
|
||||||
|
int lock_fd = lock_file(get_cache_path().c_str());
|
||||||
|
|
||||||
// Check Version
|
// Check Version
|
||||||
unsigned char cache_version;
|
unsigned char cache_version;
|
||||||
stream.read((char *) &cache_version, 1);
|
stream.read((char *) &cache_version, 1);
|
||||||
@ -84,10 +84,10 @@ launcher_cache load_cache() {
|
|||||||
ret = cache;
|
ret = cache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Unlock File
|
// Unlock File
|
||||||
unlock_file(get_cache_path().c_str(), lock_fd);
|
unlock_file(get_cache_path().c_str(), lock_fd);
|
||||||
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return ret;
|
return ret;
|
||||||
@ -106,15 +106,15 @@ void save_cache() {
|
|||||||
// Log
|
// Log
|
||||||
DEBUG("Saving Launcher Cache...");
|
DEBUG("Saving Launcher Cache...");
|
||||||
|
|
||||||
// Lock File
|
|
||||||
int lock_fd = lock_file(get_cache_path().c_str());
|
|
||||||
|
|
||||||
// Open File
|
// Open File
|
||||||
std::ofstream stream(get_cache_path(), std::ios::out | std::ios::binary);
|
std::ofstream stream(get_cache_path(), std::ios::out | std::ios::binary);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
// Fail
|
// Fail
|
||||||
WARN("Unable To Open Launcher Cache For Saving");
|
WARN("Unable To Open Launcher Cache For Saving");
|
||||||
} else {
|
} else {
|
||||||
|
// Lock File
|
||||||
|
int lock_fd = lock_file(get_cache_path().c_str());
|
||||||
|
|
||||||
// Save Cache Version
|
// Save Cache Version
|
||||||
unsigned char cache_version = (unsigned char) CACHE_VERSION;
|
unsigned char cache_version = (unsigned char) CACHE_VERSION;
|
||||||
stream.write((const char *) &cache_version, 1);
|
stream.write((const char *) &cache_version, 1);
|
||||||
@ -153,10 +153,10 @@ void save_cache() {
|
|||||||
if (!stream.good()) {
|
if (!stream.good()) {
|
||||||
WARN("Failure While Saving Launcher Cache");
|
WARN("Failure While Saving Launcher Cache");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Unlock File
|
// Unlock File
|
||||||
unlock_file(get_cache_path().c_str(), lock_fd);
|
unlock_file(get_cache_path().c_str(), lock_fd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wipe Cache
|
// Wipe Cache
|
||||||
|
@ -28,7 +28,7 @@ int is_progress_difference_significant(int32_t new_val, int32_t old_val) {
|
|||||||
|
|
||||||
// Lock File
|
// Lock File
|
||||||
int lock_file(const char *file) {
|
int lock_file(const char *file) {
|
||||||
int fd = open(file, O_WRONLY | O_CREAT, S_IWUSR);
|
int fd = open(file, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
ERR("Unable To Open Lock File: %s: %s", file, strerror(errno));
|
ERR("Unable To Open Lock File: %s: %s", file, strerror(errno));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user