File tree Expand file tree Collapse file tree
SolutionProjectModel/cppexec Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #include " ..\Project.h"
1+ #include " ..\Project.h"
2+ #include < filesystem>
3+ using namespace std ;
4+ using namespace filesystem ;
25
3- int wmain (int argc, wchar_t ** argv)
4- {
6+ int wmain (int argc, wchar_t ** argv)
7+ {
8+ path exePath (argv[0 ]);
9+ auto dir = weakly_canonical (exePath).parent_path ();
10+ path scriptToRun;
511
6- return 0 ;
7- }
12+ for (auto & pit : directory_iterator (dir))
13+ {
14+ auto & filePath = pit.path ();
15+ auto ext = filePath.extension ();
16+
17+ if ( ext == " .cpp" )
18+ {
19+ if (scriptToRun.empty ())
20+ {
21+ scriptToRun = filePath;
22+ }
23+ else
24+ {
25+ scriptToRun.clear ();
26+ break ;
27+ }
28+ }
29+ } // for
30+
31+ if (scriptToRun.empty ())
32+ {
33+ printf (" Usage: %S <.cpp script to run>\r\n " , exePath.stem ().c_str ());
34+ return -2 ;
35+ }
36+
37+ return 0 ;
38+ }
839
You can’t perform that action at this time.
0 commit comments