Skip to content

Commit

Permalink
Fix blender file picker
Browse files Browse the repository at this point in the history
  • Loading branch information
dbierek committed Dec 8, 2024
1 parent 0855bd0 commit ab26c1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/NavKit/FileUtil.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include "..\nativefiledialog-extended\nfd.h"
#include <filesystem>

namespace FileUtil {
char* openNfdLoadDialog(nfdu8filteritem_t* filters, nfdfiltersize_t filterCount, char* defaultPath = NULL);
char* openNfdSaveDialog(nfdu8filteritem_t* filters, nfdfiltersize_t filterCount, const nfdu8char_t* defaultName, char* defaultPath = NULL);
Expand Down
5 changes: 4 additions & 1 deletion src/FileUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ namespace FileUtil {
nfdopendialogu8args_t args = {
.filterList = filters,
.filterCount = filterCount,
.defaultPath = path.c_str(),
};

if (std::filesystem::exists(path) && !std::filesystem::is_directory(path)) {
args.defaultPath = path.c_str();
}
nfdresult_t result = NFD_OpenDialogU8_With(&outPath, &args);
if (result == NFD_OKAY)
{
Expand Down

0 comments on commit ab26c1f

Please sign in to comment.