mirror of
https://github.com/transmission/transmission.git
synced 2026-05-01 06:02:38 +01:00
refactor: use std::string in tr_file (#2382)
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user