Merge remote-tracking branch 'upstream/master' into RDLines

This commit is contained in:
Jaklyy 2024-02-24 14:20:25 -05:00
commit 403674ebf4
4 changed files with 36 additions and 17 deletions

View File

@ -43,6 +43,7 @@ jobs:
with: with:
name: macOS-${{ matrix.arch }} name: macOS-${{ matrix.arch }}
path: macOS-${{ matrix.arch }}.zip path: macOS-${{ matrix.arch }}.zip
retention-days: 1
universal-binary: universal-binary:
name: Universal binary name: Universal binary
@ -75,10 +76,10 @@ jobs:
with: with:
name: macOS-universal name: macOS-universal
path: macOS-universal.zip path: macOS-universal.zip
- name: Clean up architecture-specific artifacts # - name: Clean up architecture-specific artifacts
uses: geekyeggo/delete-artifact@v4 # uses: geekyeggo/delete-artifact@v4
with: # with:
failOnError: false # failOnError: false
name: | # name: |
macOS-x86_64 # macOS-x86_64
macOS-arm64 # macOS-arm64

View File

@ -3,11 +3,7 @@
#include "loader.h" #include "loader.h"
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#ifdef __APPLE__
#include <stdlib.h> #include <stdlib.h>
#else
#include <malloc.h>
#endif
Log_SetChannel(GL::Context); Log_SetChannel(GL::Context);
#if defined(_WIN32) #if defined(_WIN32)

View File

@ -31,6 +31,7 @@
#include <QMutex> #include <QMutex>
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QSharedMemory> #include <QSharedMemory>
#include <QTemporaryFile>
#include <SDL_loadso.h> #include <SDL_loadso.h>
#include "Platform.h" #include "Platform.h"
@ -333,13 +334,29 @@ bool LocalFileExists(const std::string& name)
bool CheckFileWritable(const std::string& filepath) bool CheckFileWritable(const std::string& filepath)
{ {
FileHandle* file = Platform::OpenFile(filepath.c_str(), FileMode::Append); FileHandle* file = Platform::OpenFile(filepath.c_str(), FileMode::Read);
if (file) if (file)
{ {
// if the file exists, check if it can be opened for writing.
Platform::CloseFile(file); Platform::CloseFile(file);
return true; file = Platform::OpenFile(filepath.c_str(), FileMode::Append);
if (file)
{
Platform::CloseFile(file);
return true;
}
else return false;
}
else
{
// if the file does not exist, create a temporary file to check, to avoid creating an empty file.
if (QTemporaryFile(filepath.c_str()).open())
{
return true;
}
else return false;
} }
else return false;
} }
bool CheckLocalFileWritable(const std::string& name) bool CheckLocalFileWritable(const std::string& name)

View File

@ -32,11 +32,16 @@ add_library(teakra
register.h register.h
shared_memory.h shared_memory.h
teakra.cpp teakra.cpp
test.h
test_generator.cpp
test_generator.h
) )
if (TEAKRA_BUILD_UNIT_TESTS)
target_sources(teakra PUBLIC
test.h
test_generator.cpp
test_generator.h
)
endif()
create_target_directory_groups(teakra) create_target_directory_groups(teakra)
target_link_libraries(teakra PRIVATE Threads::Threads) target_link_libraries(teakra PRIVATE Threads::Threads)