Upload new files

This commit is contained in:
blahpy
2020-09-09 16:54:16 +12:00
parent 2075dd66b6
commit eb886d0c45
6 changed files with 57 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
add_library(common_util
SHARED
FileUtil.cpp)
target_link_libraries(common_util fmt)
+26
View File
@@ -0,0 +1,26 @@
#include "FileUtil.h"
#include <iostream>
#include <filesystem>
std::string FileUtil::get_file_path(std::string input[]) {
int arrSize = std::sizeof(input);
std::string currentPath = std::filesystem::current_path();
char dirSeparator;
#ifdef _WIN32
dirSeparator = '\';
#else
dirSeparator = '/';
#endif
std::string filePath = currentPath;
for (int i = 0; i < arrSize; i++) {
if (arrSize = i+1) {
filePath = filePath << input[i];
} else {
filePath = filePath << input[i] << dirSeparator;
}
}
return filePath;
}
+11
View File
@@ -0,0 +1,11 @@
#pragma once
#include <string>
namespace FileUtil
{
class FileUtil
{
public:
std::string get_file_path();
};
}