refactor: use std::string in tr_file (#2382)

This commit is contained in:
Charles Kerr
2022-01-08 12:53:35 -06:00
committed by GitHub
parent 0c16c454ba
commit 8b65b660c8
18 changed files with 138 additions and 146 deletions

View File

@@ -69,7 +69,7 @@ OSStatus GeneratePreviewForURL(void* thisInterface, QLPreviewRequestRef preview,
NSString* name = [NSString stringWithUTF8String:metainfo.name().c_str()];
auto const n_files = std::size(metainfo.files());
auto const n_files = metainfo.fileCount();
auto const is_multifile = n_files > 1;
NSString* fileTypeString = is_multifile ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [name pathExtension];
@@ -190,9 +190,9 @@ OSStatus GeneratePreviewForURL(void* thisInterface, QLPreviewRequestRef preview,
#warning display size?
#warning display folders?
for (auto const& file : metainfo.files())
for (tr_file_index_t i = 0; i < n_files; ++i)
{
NSString* fullFilePath = [NSString stringWithUTF8String:file.path().c_str()];
NSString* fullFilePath = [NSString stringWithUTF8String:metainfo.fileSubpath(i).c_str()];
NSCAssert([fullFilePath hasPrefix:[name stringByAppendingString:@"/"]], @"Expected file path %@ to begin with %@/", fullFilePath, name);
NSString* shortenedFilePath = [fullFilePath substringFromIndex:[name length] + 1];