Skip to content

Commit fd6c29a

Browse files
committed
fix file path
1 parent e9f2484 commit fd6c29a

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/inspector/storage_agent.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <string>
33
#include "env-inl.h"
44
#include "inspector/protocol_helper.h"
5+
#include "node_url.h"
56
#include "util-inl.h"
67
#include "v8-isolate.h"
78
#include "v8-local-handle.h"
@@ -20,16 +21,10 @@ void StorageAgent::Wire(protocol::UberDispatcher* dispatcher) {
2021
DispatchResponse StorageAgent::getStorageKey(
2122
std::optional<protocol::String> frameId, protocol::String* storageKey) {
2223
auto local_storage_file = env_->options()->localstorage_file;
23-
*storageKey = to_file_url(local_storage_file);
24+
*storageKey = node::url::FromFilePath(local_storage_file);
2425
return protocol::DispatchResponse::Success();
2526
}
2627

27-
std::string StorageAgent::to_file_url(const std::filesystem::path& input) {
28-
std::filesystem::path abs =
29-
std::filesystem::weakly_canonical(std::filesystem::absolute(input));
30-
return "file://" + abs.generic_string();
31-
}
32-
3328
} // namespace protocol
3429
} // namespace inspector
3530
} // namespace node

src/inspector/storage_agent.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class StorageAgent : public protocol::Storage::Backend {
2626
private:
2727
std::unique_ptr<protocol::Storage::Frontend> frontend_;
2828
Environment* env_;
29-
std::string to_file_url(const std::filesystem::path& input);
3029
};
3130
} // namespace protocol
3231
} // namespace inspector

0 commit comments

Comments
 (0)