-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathVPhysToOpt.cpp
More file actions
40 lines (35 loc) · 1.34 KB
/
VPhysToOpt.cpp
File metadata and controls
40 lines (35 loc) · 1.34 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
#include "OptimizedGeometry.h"
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main(int argc, char** argv) {
if (argc < 2) {
std::cout << "Usage: VPhysToOpt <directory_path>\n";
return 1;
}
fs::path directory(argv[1]);
if (!fs::exists(directory) || !fs::is_directory(directory)) {
std::cerr << "The specified directory does not exist or is not a directory.\n";
return 1;
}
for (const auto& entry : fs::directory_iterator(directory)) {
if (entry.is_regular_file()) {
fs::path filePath = entry.path();
if (filePath.extension() == ".vphys") {
std::string rawFile = filePath.string();
fs::path optPath = filePath;
optPath.replace_extension(".opt");
std::string optFile = optPath.string();
std::cout << "Processing " << rawFile << " -> " << optFile << std::endl;
OptimizedGeometry geom;
if (geom.CreateOptimizedFile(rawFile, optFile)) {
std::cout << "Successfully saved: " << optFile << std::endl;
}
else {
std::cerr << "Error converting " << rawFile << std::endl;
}
}
}
}
return 0;
}