Set working directory of the application to be the executable location #16
|
@ -7,6 +7,7 @@
|
|||
#endif // SHEDITOR
|
||||
|
||||
#include "Tools/SHLogger.h"
|
||||
#include "Tools/SHFileUtilties.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <ratio>
|
||||
|
@ -23,7 +24,8 @@ namespace Sandbox
|
|||
_In_ INT nCmdShow
|
||||
)
|
||||
{
|
||||
SHLOG_TITLE("Initialising SBApplication")
|
||||
// Set working directory
|
||||
SHADE::SHFileUtilities::SetWorkDirToExecDir();
|
||||
|
||||
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;assimp-vc142-mtd.lib;librttr_core_d.lib;spdlogd.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\spdlog\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;shlwapi.lib;assimp-vc142-mtd.lib;ktxd.lib;librttr_core_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\ktx\lib\Debug;..\Dependencies\ktx\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ImportLibrary>..\bin\Debug\SHADE_Engine.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -99,8 +99,8 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;assimp-vc142-mt.lib;librttr_core.lib;spdlog.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\spdlog\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;shlwapi.lib;assimp-vc142-mt.lib;ktx.lib;librttr_core.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\ktx\lib\Debug;..\Dependencies\ktx\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ImportLibrary>..\bin\Release\SHADE_Engine.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -196,6 +196,7 @@
|
|||
<ClInclude Include="src\Scene\SHSceneManager.h" />
|
||||
<ClInclude Include="src\Tools\SHException.h" />
|
||||
<ClInclude Include="src\Tools\SHExceptionHandler.h" />
|
||||
<ClInclude Include="src\Tools\SHFileUtilties.h" />
|
||||
<ClInclude Include="src\Tools\SHLogger.h" />
|
||||
<ClInclude Include="src\Tools\SHUtilities.h" />
|
||||
</ItemGroup>
|
||||
|
@ -268,6 +269,7 @@
|
|||
<ClCompile Include="src\Scene\SHSceneManager.cpp" />
|
||||
<ClCompile Include="src\Tools\SHException.cpp" />
|
||||
<ClCompile Include="src\Tools\SHExceptionHandler.cpp" />
|
||||
<ClCompile Include="src\Tools\SHFileUtilties.cpp" />
|
||||
<ClCompile Include="src\Tools\SHLogger.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -377,6 +377,9 @@
|
|||
<ClInclude Include="src\Tools\SHExceptionHandler.h">
|
||||
<Filter>Tools</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Tools\SHFileUtilties.h">
|
||||
<Filter>Tools</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Tools\SHLogger.h">
|
||||
<Filter>Tools</Filter>
|
||||
</ClInclude>
|
||||
|
@ -581,6 +584,9 @@
|
|||
<ClCompile Include="src\Tools\SHExceptionHandler.cpp">
|
||||
<Filter>Tools</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Tools\SHFileUtilties.cpp">
|
||||
<Filter>Tools</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Tools\SHLogger.cpp">
|
||||
<Filter>Tools</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -56,7 +56,8 @@ project "SHADE_Engine"
|
|||
"reactphysics3d",
|
||||
"imgui",
|
||||
"vulkan-1.lib",
|
||||
"shaderc_shared.lib"
|
||||
"shaderc_shared.lib",
|
||||
"shlwapi"
|
||||
}
|
||||
|
||||
defines
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/************************************************************************************//*!
|
||||
\file SHFileUtilities.cpp
|
||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||
\par email: kahwei.tng\@digipen.edu
|
||||
\date Sep 15, 2022
|
||||
\brief Contains the definition of functions of the SHFileUtilities static class.
|
||||
|
||||
Copyright (C) 2022 DigiPen Institute of Technology.
|
||||
Reproduction or disclosure of this file or its contents without the prior written consent
|
||||
of DigiPen Institute of Technology is prohibited.
|
||||
*//*************************************************************************************/
|
||||
// Precompiled Header
|
||||
#include "SHpch.h"
|
||||
// Primary Header
|
||||
#include "SHFileUtilties.h"
|
||||
// Standard Libraries
|
||||
#include <filesystem>
|
||||
// External Dependencies
|
||||
#include <shlwapi.h> // GetModuleFileName, PathRemoveFileSpec
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
void SHFileUtilities::SetWorkDirToExecDir()
|
||||
{
|
||||
TCHAR currentExecFilePath[MAX_PATH] = { '\0' };
|
||||
GetModuleFileName(nullptr, currentExecFilePath, MAX_PATH);
|
||||
PathRemoveFileSpec(currentExecFilePath);
|
||||
std::filesystem::current_path(currentExecFilePath);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/************************************************************************************//*!
|
||||
\file SHFileUtilities.h
|
||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||
\par email: kahwei.tng\@digipen.edu
|
||||
\date Sep 15, 2022
|
||||
\brief Contains the SHFileUtilities static class.
|
||||
|
||||
Copyright (C) 2022 DigiPen Institute of Technology.
|
||||
Reproduction or disclosure of this file or its contents without the prior written consent
|
||||
of DigiPen Institute of Technology is prohibited.
|
||||
*//*************************************************************************************/
|
||||
|
||||
// Project Headers
|
||||
#include "SH_API.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
/*!************************************************************************************
|
||||
|
||||
\class SHFileUtilities
|
||||
|
||||
\brief
|
||||
Static class that contains functions for working with files and directories.
|
||||
|
||||
**************************************************************************************/
|
||||
class SH_API SHFileUtilities
|
||||
{
|
||||
public:
|
||||
/*!**********************************************************************************
|
||||
|
||||
\brief
|
||||
Sets the application's current working directory to the application executable's
|
||||
directory.
|
||||
|
||||
************************************************************************************/
|
||||
static void SetWorkDirToExecDir();
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue