mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-06 23:51:21 +00:00
IGFD: fix extension-less overwrite check
This commit is contained in:
parent
52b071aa6b
commit
4baefa569b
2 changed files with 12 additions and 3 deletions
13
extern/igfd/ImGuiFileDialog.cpp
vendored
13
extern/igfd/ImGuiFileDialog.cpp
vendored
|
@ -1934,14 +1934,23 @@ namespace IGFD
|
|||
prCurrentPath = vCurrentPath;
|
||||
}
|
||||
|
||||
bool IGFD::FileManager::IsFileExist(const std::string& vFile)
|
||||
bool IGFD::FileManager::IsFileExist(const std::string& vFile, const std::string& vFileExt)
|
||||
{
|
||||
std::ifstream docFile(vFile, std::ios::in);
|
||||
logV("IGFD: IsFileExist(%s)",vFile);
|
||||
if (docFile.is_open())
|
||||
{
|
||||
docFile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::ifstream docFileE(vFile+vFileExt, std::ios::in);
|
||||
logV("IGFD: IsFileExist(%s)",vFile+vFileExt);
|
||||
if (docFileE.is_open())
|
||||
{
|
||||
docFileE.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4564,7 +4573,7 @@ namespace IGFD
|
|||
{
|
||||
if (prFileDialogInternal.puIsOk) // catched only one time
|
||||
{
|
||||
if (!prFileDialogInternal.puFileManager.IsFileExist(GetFilePathName())) // not existing => quit dialog
|
||||
if (!prFileDialogInternal.puFileManager.IsFileExist(GetFilePathName(),prFileDialogInternal.puFilterManager.GetSelectedFilter().firstFilter)) // not existing => quit dialog
|
||||
{
|
||||
QuitFrame();
|
||||
return true;
|
||||
|
|
2
extern/igfd/ImGuiFileDialog.h
vendored
2
extern/igfd/ImGuiFileDialog.h
vendored
|
@ -913,7 +913,7 @@ namespace IGFD
|
|||
bool SetPathOnParentDirectoryIfAny(); // compose paht on parent directory
|
||||
std::string GetCurrentPath(); // get the current path
|
||||
void SetCurrentPath(const std::string& vCurrentPath); // set the current path
|
||||
static bool IsFileExist(const std::string& vFile);
|
||||
static bool IsFileExist(const std::string& vFile, const std::string& vFileExt);
|
||||
void SetDefaultFileName(const std::string& vFileName);
|
||||
bool SelectDirectory(const FileInfos& vInfos); // enter directory
|
||||
void SelectFileName(const FileDialogInternal& vFileDialogInternal,
|
||||
|
|
Loading…
Reference in a new issue