11#include < binaryninjaapi.h>
22
3- #include < filesystem>
4-
53#include " processor.h"
64#include " provider.h"
75
@@ -11,14 +9,21 @@ namespace {
119 void ExportBinExport (BinaryView* view)
1210 {
1311 const std::string inputFilename = view->GetFile ()->GetFilename ();
14- std::filesystem::path outputPath = inputFilename.empty () ? " export.BinExport" : inputFilename;
15- outputPath.replace_extension (" .BinExport" );
12+ std::string outputPath = inputFilename.empty () ? " export.BinExport" : inputFilename;
13+ if (!inputFilename.empty ())
14+ {
15+ const size_t separator = outputPath.find_last_of (" /\\ " );
16+ const size_t filenameStart = separator == std::string::npos ? 0 : separator + 1 ;
17+ const size_t extension = outputPath.find_last_of (' .' );
18+ if ((extension != std::string::npos) && (extension > filenameStart))
19+ outputPath.resize (extension);
20+ outputPath += " .BinExport" ;
21+ }
1622
1723 if (IsUIEnabled ())
1824 {
1925 std::string selectedPath;
20- if (!GetSaveFileNameInput (
21- selectedPath, " Export BinExport" , " BinExport files (*.BinExport)" , outputPath.string ()))
26+ if (!GetSaveFileNameInput (selectedPath, " Export BinExport" , " BinExport files (*.BinExport)" , outputPath))
2227 return ;
2328 outputPath = selectedPath;
2429 }
@@ -33,7 +38,7 @@ namespace {
3338 BinDiffProcessor processor (*view);
3439 for (const auto & function : view->GetAnalysisFunctionList ())
3540 processor.AddFunction (*function);
36- success = processor.Process (outputPath. string () );
41+ success = processor.Process (outputPath);
3742 }
3843 if (!success && IsUIEnabled ())
3944 {
0 commit comments