Skip to content

Commit

Permalink
IGL: Only include windows.h on Windows
Browse files Browse the repository at this point in the history
Summary: This diff updates ImageLoaderWin and FileLoaderWin to only include windows.h and call GetModuleFileNameW on Windows.

Reviewed By: corporateshark

Differential Revision: D49137713

fbshipit-source-id: 3bf8efb84de1b1fd3f61c6c4a9d328c6c7d15368
  • Loading branch information
Eric Griffith authored and facebook-github-bot committed Sep 11, 2023
1 parent 5b171b0 commit b1a0189
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions shell/shared/fileLoader/win/FileLoaderWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@
#include <igl/Common.h>
#include <iterator>
#include <string>

#if IGL_PLATFORM_WIN
#include <windows.h>
#endif

namespace igl::shell {

FileLoaderWin::FileLoaderWin() {
#if IGL_PLATFORM_WIN
wchar_t path[MAX_PATH] = {0};
if (IGL_VERIFY(GetModuleFileNameW(NULL, path, MAX_PATH) != 0)) {
basePath_ = std::filesystem::path(path).parent_path().string();
}
#endif
}

std::vector<uint8_t> FileLoaderWin::loadBinaryData(const std::string& fileName) {
Expand Down
5 changes: 5 additions & 0 deletions shell/shared/imageLoader/win/ImageLoaderWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
#include <igl/Common.h>
#include <stb_image.h>
#include <stdint.h>

#if IGL_PLATFORM_WIN
#include <windows.h>
#endif

namespace igl::shell {

Expand All @@ -25,10 +28,12 @@ ImageLoaderWin::ImageLoaderWin() {
// @fb-only
// @fb-only
// @fb-only
#if IGL_PLATFORM_WIN
wchar_t path[MAX_PATH] = {0};
if (IGL_VERIFY(GetModuleFileNameW(NULL, path, MAX_PATH) != 0)) {
executablePath_ = std::filesystem::path(path).parent_path().string();
}
#endif
}

ImageLoaderWin::ImageLoaderWin(const std::string& homePath) {
Expand Down

0 comments on commit b1a0189

Please sign in to comment.