summaryrefslogtreecommitdiff
path: root/cmds/cmd/cmd.cpp
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2023-09-01 22:06:31 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-09-01 22:06:31 +0000
commit0d0326fd9ade80c6389ac5cb1c3db1c8d12c64cd (patch)
tree71217f10aea8dcefb3c64d5a35ae201db34201e8 /cmds/cmd/cmd.cpp
parentefce371535f2c3cc3edf16370ec8b2a643771e47 (diff)
parent09f0cc608e964732a05e15471d5c4daacf31249d (diff)
Merge "Migrate from android::String path functions to std::filesystem" into main
Diffstat (limited to 'cmds/cmd/cmd.cpp')
-rw-r--r--cmds/cmd/cmd.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmds/cmd/cmd.cpp b/cmds/cmd/cmd.cpp
index b7273987b6..0ce7711574 100644
--- a/cmds/cmd/cmd.cpp
+++ b/cmds/cmd/cmd.cpp
@@ -27,6 +27,7 @@
#include <utils/Mutex.h>
#include <utils/Vector.h>
+#include <filesystem>
#include <getopt.h>
#include <stdlib.h>
#include <stdio.h>
@@ -69,10 +70,8 @@ public:
virtual int openFile(const String16& path, const String16& seLinuxContext,
const String16& mode) {
String8 path8(path);
- char cwd[256];
- getcwd(cwd, 256);
- String8 fullPath(cwd);
- fullPath.appendPath(path8);
+ auto fullPath = std::filesystem::current_path();
+ fullPath /= path8.c_str();
if (!mActive) {
mErrorLog << "Open attempt after active for: " << fullPath << endl;
return -EPERM;