]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/android/stat_owner.cpp
Minimalistic port for Android
[libs/core.git] / source / fs / android / stat_owner.cpp
diff --git a/source/fs/android/stat_owner.cpp b/source/fs/android/stat_owner.cpp
new file mode 100644 (file)
index 0000000..45fba30
--- /dev/null
@@ -0,0 +1,26 @@
+#include <grp.h>
+#include <pwd.h>
+#include <msp/strings/format.h>
+#include "stat.h"
+#include "stat_private.h"
+
+namespace Msp {
+namespace FS {
+
+void Stat::Private::fill_owner_info(Stat::OwnerInfo &result)
+{
+       struct passwd *owner;
+       if((owner = getpwuid(owner_id)))
+               result.owner = owner->pw_name;
+       else
+               result.owner = format("%d", owner_id);
+
+       struct group *group;
+       if((group = getgrgid(group_id)))
+               result.group = group->gr_name;
+       else
+               result.group = format("%d", group_id);
+}
+
+} // namespace FS
+} // namespace Msp