-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.cpp
More file actions
41 lines (33 loc) · 1.31 KB
/
app.cpp
File metadata and controls
41 lines (33 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <locale>
#include <codecvt>
#include <string>
#include <filesystem>
using namespace std;
int main(int argc, char* argv[]) {
if (argv[1] == nullptr) {
cout << "Please input skm file path" << endl;
return 1;
}
// filesystem::path cwd = std::filesystem::current_path();
filesystem::path path(argv[0]);
filesystem::path directory = path.parent_path();
// 带有空格路径和参数的程序
// std::string exePath = "\"\"D:\\Work Space\\skip\\main.exe\"";
// std::string pythonPath = "\"\"D:\\Work Space\\skip\\render\\blender.exe\" -b -P \"D:\\Work Space\\skip\\main.py\" -- ";
// std::string programArgs = "\"D:\\SKP Files\\shafa.skp\"\"";
string exePath = "\"\"" + directory.string() + "\\main.exe\"";
string pythonPath = "\"\"" + directory.string() + "\\render\\blender.exe\" -b -P " + "\"" + directory.string() + "\\main.py\" -- ";
string programArgs = "\"" + string(argv[1]) + "\"\"";
// 构造完整的命令
string exeCommand = "cmd /c " + exePath + " " + programArgs;
string pythonCommand = "cmd /c " + pythonPath + " " + programArgs;
cout<<exeCommand<<endl;
// 执行命令
system(exeCommand.c_str());
system(pythonCommand.c_str());
return 0;
}