Skip to content

Commit 8dcebaa

Browse files
xuhancnpytorchmergebot
authored andcommitted
[AOTI] add WIN32 implement for create_temp_dir (#158570)
add Windows implement for `create_temp_dir`. Pull Request resolved: #158570 Approved by: https://github.com/angelayi
1 parent 7e34f9c commit 8dcebaa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

torch/csrc/inductor/aoti_package/model_package_loader.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ bool file_exists(const std::string& path) {
4747

4848
std::string create_temp_dir() {
4949
#ifdef _WIN32
50-
throw std::runtime_error("Not implemented");
50+
try {
51+
fs::path temp_dir = fs::temp_directory_path();
52+
return temp_dir.string();
53+
} catch (const fs::filesystem_error& e) {
54+
throw std::runtime_error(
55+
"Failed to get temporary directory: " + std::string(e.what()));
56+
} catch (...) {
57+
throw std::runtime_error(
58+
"Unknown error occurred while getting temporary directory");
59+
}
5160
#else
5261
std::string temp_dir = "/tmp/XXXXXX";
5362
if (mkdtemp(temp_dir.data()) == nullptr) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy