| 108 | } |
| 109 | |
| 110 | static bool |
| 111 | LoadPlaylistFileInfo(PlaylistInfo &info, |
| 112 | const Path parent_path_fs, |
| 113 | const Path name_fs) |
| 114 | { |
| 115 | if (name_fs.HasNewline()) |
| 116 | return false; |
| 117 | |
| 118 | const auto *const name_fs_str = name_fs.c_str(); |
| 119 | const auto *const name_fs_end = |
| 120 | FindStringSuffix(name_fs_str, |
| 121 | PATH_LITERAL(PLAYLIST_FILE_SUFFIX)); |
| 122 | if (name_fs_end == nullptr || |
| 123 | /* no empty playlist names (raw file name = ".m3u") */ |
| 124 | name_fs_end == name_fs_str) |
| 125 | return false; |
| 126 | |
| 127 | FileInfo fi; |
| 128 | if (!GetFileInfo(parent_path_fs / name_fs, fi) || |
| 129 | !fi.IsRegular()) |
| 130 | return false; |
| 131 | |
| 132 | const auto name = AllocatedPath::FromFS(name_fs_str, name_fs_end); |
| 133 | |
| 134 | try { |
| 135 | info.name = name.ToUTF8Throw(); |
| 136 | } catch (...) { |
| 137 | return false; |
| 138 | } |
| 139 | |
| 140 | info.mtime = fi.GetModificationTime(); |
| 141 | return true; |
| 142 | } |
| 143 | |
| 144 | PlaylistVector |
| 145 | ListPlaylistFiles() |
no test coverage detected