Compare commits

...

6 Commits

Author SHA1 Message Date
ameerj 3d9d0cbd26 common/fs/file: Update documentation for {Append/Write}StringToFile 2021-06-19 08:55:19 -04:00
ameerj 371720818e common/fs: Fix file write/append access when file does not exist.
This fixes errors when a file is being opened for write/append access, but the file does not exist initially.

These functions were not respecting the FileAccessMode which specify that the file will be created if it does not exist.
2021-06-18 19:23:18 -04:00
Mai M 3870ba670f Merge pull request #6484 from CaptV0rt3x/discord-rpc
update submodule discord-rpc to latest [now deprecated]
2021-06-18 15:18:15 -04:00
Vortex 8a83e3412a update submodule discord-rpc to latest [now deprecated] 2021-06-18 23:13:17 +05:30
Rodrigo Locatti bb18a6533d Merge pull request #6478 from ameerj/vk-layer-settings
vulkan_debug_callback: Skip logging known false-positive validation errors
2021-06-18 10:10:49 -03:00
ameerj 0b172d12c0 vulkan_debug_callback: Skip logging known false-positive validation errors
Avoids overwhelming the log with validation errors that are not applicable
2021-06-17 22:16:32 -04:00
6 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -18,7 +18,7 @@
url = https://github.com/libusb/libusb.git
[submodule "discord-rpc"]
path = externals/discord-rpc
url = https://github.com/discordapp/discord-rpc.git
url = https://github.com/discord/discord-rpc.git
[submodule "Vulkan-Headers"]
path = externals/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
-10
View File
@@ -172,23 +172,13 @@ std::string ReadStringFromFile(const std::filesystem::path& path, FileType type)
size_t WriteStringToFile(const std::filesystem::path& path, FileType type,
std::string_view string) {
if (!IsFile(path)) {
return 0;
}
IOFile io_file{path, FileAccessMode::Write, type};
return io_file.WriteString(string);
}
size_t AppendStringToFile(const std::filesystem::path& path, FileType type,
std::string_view string) {
if (!IsFile(path)) {
return 0;
}
IOFile io_file{path, FileAccessMode::Append, type};
return io_file.WriteString(string);
}
+2
View File
@@ -72,6 +72,7 @@ template <typename Path>
/**
* Writes a string to a file at path and returns the number of characters successfully written.
* If a file already exists at path, its contents will be erased.
* If a file does not exist at path, it creates and opens a new empty file for writing.
* If the filesystem object at path is not a file, this function returns 0.
*
* @param path Filesystem path
@@ -95,6 +96,7 @@ template <typename Path>
/**
* Appends a string to a file at path and returns the number of characters successfully written.
* If a file does not exist at path, it creates and opens a new empty file for appending.
* If the filesystem object at path is not a file, this function returns 0.
*
* @param path Filesystem path
+7 -3
View File
@@ -135,9 +135,13 @@ std::shared_ptr<IOFile> FileOpen(const fs::path& path, FileAccessMode mode, File
return nullptr;
}
if (!IsFile(path)) {
LOG_ERROR(Common_Filesystem, "Filesystem object at path={} is not a file",
PathToUTF8String(path));
const bool needs_existing_file =
mode == FileAccessMode::Read || mode == FileAccessMode::ReadWrite;
if (needs_existing_file && !IsFile(path)) {
LOG_ERROR(Common_Filesystem,
"Filesystem object at path={} is not a file."
"FileAccessMode={} requires a file to exist in order to be accessed",
PathToUTF8String(path), mode);
return nullptr;
}
@@ -12,6 +12,14 @@ VkBool32 Callback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
VkDebugUtilsMessageTypeFlagsEXT type,
const VkDebugUtilsMessengerCallbackDataEXT* data,
[[maybe_unused]] void* user_data) {
// Skip logging known false-positive validation errors
switch (static_cast<u32>(data->messageIdNumber)) {
case 0x682a878au: // VUID-vkCmdBindVertexBuffers2EXT-pBuffers-parameter
case 0x99fb7dfdu: // UNASSIGNED-RequiredParameter (vkCmdBindVertexBuffers2EXT pBuffers[0])
return VK_FALSE;
default:
break;
}
const std::string_view message{data->pMessage};
if (severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) {
LOG_CRITICAL(Render_Vulkan, "{}", message);