IGFD: fix extension-less overwrite check
This commit is contained in:
parent
52b071aa6b
commit
4baefa569b
13
extern/igfd/ImGuiFileDialog.cpp
vendored
13
extern/igfd/ImGuiFileDialog.cpp
vendored
|
@ -1934,14 +1934,23 @@ namespace IGFD
|
||||||
prCurrentPath = vCurrentPath;
|
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);
|
std::ifstream docFile(vFile, std::ios::in);
|
||||||
|
logV("IGFD: IsFileExist(%s)",vFile);
|
||||||
if (docFile.is_open())
|
if (docFile.is_open())
|
||||||
{
|
{
|
||||||
docFile.close();
|
docFile.close();
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4564,7 +4573,7 @@ namespace IGFD
|
||||||
{
|
{
|
||||||
if (prFileDialogInternal.puIsOk) // catched only one time
|
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();
|
QuitFrame();
|
||||||
return true;
|
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
|
bool SetPathOnParentDirectoryIfAny(); // compose paht on parent directory
|
||||||
std::string GetCurrentPath(); // get the current path
|
std::string GetCurrentPath(); // get the current path
|
||||||
void SetCurrentPath(const std::string& vCurrentPath); // set 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);
|
void SetDefaultFileName(const std::string& vFileName);
|
||||||
bool SelectDirectory(const FileInfos& vInfos); // enter directory
|
bool SelectDirectory(const FileInfos& vInfos); // enter directory
|
||||||
void SelectFileName(const FileDialogInternal& vFileDialogInternal,
|
void SelectFileName(const FileDialogInternal& vFileDialogInternal,
|
||||||
|
|
Loading…
Reference in a new issue