From 8a46f8d78f12278838500f0b519c420692b7b398 Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Sun, 18 Jul 2021 20:09:25 +0200
Subject: [PATCH] [#100] Fixed Windows tmp directory magic

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 include/vkcv/File.hpp                                 |  2 ++
 modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp |  2 +-
 src/vkcv/File.cpp                                     | 10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/vkcv/File.hpp b/include/vkcv/File.hpp
index d3ac44de..06f1c485 100644
--- a/include/vkcv/File.hpp
+++ b/include/vkcv/File.hpp
@@ -6,4 +6,6 @@ namespace vkcv {
 	
 	std::filesystem::path generateTemporaryFilePath();
 	
+	std::filesystem::path generateTemporaryDirectoryPath();
+	
 }
diff --git a/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp b/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp
index 353b9ef5..0f499500 100644
--- a/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp
+++ b/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp
@@ -35,7 +35,7 @@ namespace vkcv::upscaling {
 	
 	static bool compileFSRShader(vkcv::shader::GLSLCompiler& compiler,
 								 const shader::ShaderCompiledFunction& compiled) {
-		std::filesystem::path directory = generateTemporaryFilePath();
+		std::filesystem::path directory = generateTemporaryDirectoryPath();
 		
 		if (!std::filesystem::create_directory(directory)) {
 			vkcv_log(LogLevel::ERROR, "The directory could not be created (%s)", directory.string().c_str());
diff --git a/src/vkcv/File.cpp b/src/vkcv/File.cpp
index f4f07bd4..8fc838c3 100644
--- a/src/vkcv/File.cpp
+++ b/src/vkcv/File.cpp
@@ -45,4 +45,14 @@ namespace vkcv {
 		return tmp / name;
 	}
 	
+	std::filesystem::path generateTemporaryDirectoryPath() {
+		std::filesystem::path tmp = generateTemporaryFilePath();
+		
+		if (std::filesystem::is_directory(tmp)) {
+			return std::filesystem::path(tmp.string() + "W"); // add W for Wambo
+		} else {
+			return tmp;
+		}
+	}
+	
 }
-- 
GitLab