diff options
| author | 2023-09-02 01:33:44 +0000 | |
|---|---|---|
| committer | 2023-09-02 01:33:44 +0000 | |
| commit | e4229ae205c17e6f7694e142f49ff8f16bcea63a (patch) | |
| tree | bd30f55ee34bcc19847b9a40609e17813b1568f2 | |
| parent | 997ebb80556470fc2ec3177ccd4356bd09d93358 (diff) | |
| parent | 1e3b507f85421d46b21b552953728a0c954a538d (diff) | |
Merge "Migrate from android::String path functions to std::filesystem" into main am: 0d0326fd9a am: c5a3087b46 am: cabb9a4530 am: 1e3b507f85
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2721818
Change-Id: I7bbda7d455200a9c2dac979f8bf245ba471bdbb9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | cmds/cmd/Android.bp | 3 | ||||
| -rw-r--r-- | cmds/cmd/cmd.cpp | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/cmds/cmd/Android.bp b/cmds/cmd/Android.bp index c3d2601444..27ef78854c 100644 --- a/cmds/cmd/Android.bp +++ b/cmds/cmd/Android.bp @@ -27,6 +27,9 @@ cc_library_static { "libselinux", "libbinder", ], + whole_static_libs: [ + "libc++fs", + ], cflags: [ "-Wall", 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; |