Fixed Windows version of getExecutablePath().
This commit is contained in:
		
							parent
							
								
									6d2a57485e
								
							
						
					
					
						commit
						55fb360dfa
					
				@ -2,6 +2,7 @@
 | 
				
			|||||||
#include "os.hpp"
 | 
					#include "os.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <filesystem>
 | 
					#include <filesystem>
 | 
				
			||||||
 | 
					#include "../debug/assert.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if MIJIN_TARGET_OS == MIJIN_OS_LINUX
 | 
					#if MIJIN_TARGET_OS == MIJIN_OS_LINUX
 | 
				
			||||||
    #include <mutex>
 | 
					    #include <mutex>
 | 
				
			||||||
@ -106,7 +107,7 @@ std::string getExecutablePath() MIJIN_NOEXCEPT
 | 
				
			|||||||
#elif MIJIN_TARGET_OS == MIJIN_OS_WINDOWS
 | 
					#elif MIJIN_TARGET_OS == MIJIN_OS_WINDOWS
 | 
				
			||||||
    // TODO: this is completely untested
 | 
					    // TODO: this is completely untested
 | 
				
			||||||
    std::array<char, 1024> buffer;
 | 
					    std::array<char, 1024> buffer;
 | 
				
			||||||
    if (FAILED(GetModuleFileNameA(nullptr, buffer.data(), buffer.size())))
 | 
					    if (FAILED(GetModuleFileNameA(nullptr, buffer.data(), static_cast<DWORD>(buffer.size()))))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        std::vector<char> buffer2;
 | 
					        std::vector<char> buffer2;
 | 
				
			||||||
        buffer2.resize(1024);
 | 
					        buffer2.resize(1024);
 | 
				
			||||||
@ -119,7 +120,7 @@ std::string getExecutablePath() MIJIN_NOEXCEPT
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            buffer2.resize(buffer2.size() + 1024);
 | 
					            buffer2.resize(buffer2.size() + 1024);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        while (FAILED(GetModuleFileNameA(nullptr, buffer.data(), buffer.size())));
 | 
					        while (FAILED(GetModuleFileNameA(nullptr, buffer.data(), static_cast<DWORD>(buffer.size()))));
 | 
				
			||||||
        return buffer2.data();
 | 
					        return buffer2.data();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return buffer.data();
 | 
					    return buffer.data();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user