diff options
author | Max Kellermann <max@duempel.org> | 2015-02-28 20:42:50 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-02-28 23:00:26 +0100 |
commit | 90a61b6babe3528efd982511790057e1e1e39b81 (patch) | |
tree | cae3a8072a056118865a988042e1f1269d11e277 /src/command/FileCommands.cxx | |
parent | 00583bc4a8357cf43930151650dc058225675403 (diff) | |
download | mpd-90a61b6babe3528efd982511790057e1e1e39b81.tar.gz mpd-90a61b6babe3528efd982511790057e1e1e39b81.tar.xz mpd-90a61b6babe3528efd982511790057e1e1e39b81.zip |
fs/FileInfo: new library providing GetFileInfo()
Replaces StatFile(), with a portable data object.
Diffstat (limited to '')
-rw-r--r-- | src/command/FileCommands.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index f1cb72c99..9f1c3a8e3 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -36,7 +36,7 @@ #include "TagFile.hxx" #include "storage/StorageInterface.hxx" #include "fs/AllocatedPath.hxx" -#include "fs/FileSystem.hxx" +#include "fs/FileInfo.hxx" #include "fs/DirectoryReader.hxx" #include "TimePrint.hxx" #include "ls.hxx" @@ -99,22 +99,22 @@ handle_listfiles_local(Client &client, const char *path_utf8) const AllocatedPath full_fs = AllocatedPath::Build(path_fs, name_fs); - struct stat st; - if (!StatFile(full_fs, st, false)) + FileInfo fi; + if (!GetFileInfo(full_fs, fi, false)) continue; - if (S_ISREG(st.st_mode)) { + if (fi.IsRegular()) client_printf(client, "file: %s\n" "size: %" PRIu64 "\n", name_utf8.c_str(), - uint64_t(st.st_size)); - } else if (S_ISDIR(st.st_mode)) + fi.GetSize()); + else if (fi.IsDirectory()) client_printf(client, "directory: %s\n", name_utf8.c_str()); else continue; - time_print(client, "Last-Modified", st.st_mtime); + time_print(client, "Last-Modified", fi.GetModificationTime()); } return CommandResult::OK; |