From 09f0cc608e964732a05e15471d5c4daacf31249d Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Tue, 22 Aug 2023 17:40:55 +0000 Subject: Migrate from android::String path functions to std::filesystem Bug: 295394788 Test: m checkbuild Change-Id: I7efdc32872d00c066b9a874d774e5ecdc5e53722 --- cmds/cmd/cmd.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'cmds/cmd/cmd.cpp') 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 #include +#include #include #include #include @@ -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; -- cgit v1.2.3-59-g8ed1b