mirror of
https://github.com/transmission/transmission.git
synced 2026-02-15 07:26:49 +00:00
* build: bump to C++20 Co-authored-by: Cœur <coeur@gmx.fr> * refactor: use designated initializers * refactor: remove redundant SFINAE * fix: clang-tidy warnings * chore: comments about min compiler versions for C++20 features * build: clang objc++ modules build errors Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com> * refactor: add `TR_CONSTEXPR_VEC` and `TR_CONSTEXPR_STR` * fix: don't use `std::rel_ops` * chore: housekeeping * fix: possible fix for macOS linker error --------- Co-authored-by: Cœur <coeur@gmx.fr> Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
50 lines
1.0 KiB
Plaintext
50 lines
1.0 KiB
Plaintext
// This file Copyright © Transmission authors and contributors.
|
|
// It may be used under the MIT (SPDX: MIT) license.
|
|
// License text can be found in the licenses/ folder.
|
|
|
|
#if __has_feature(modules)
|
|
@import AppKit;
|
|
#else
|
|
#import <AppKit/AppKit.h>
|
|
#endif
|
|
|
|
#import "ExpandedPathToIconTransformer.h"
|
|
|
|
@implementation ExpandedPathToIconTransformer
|
|
|
|
+ (Class)transformedValueClass
|
|
{
|
|
return [NSImage class];
|
|
}
|
|
|
|
+ (BOOL)allowsReverseTransformation
|
|
{
|
|
return NO;
|
|
}
|
|
|
|
- (id)transformedValue:(id)value
|
|
{
|
|
if (!value)
|
|
{
|
|
return nil;
|
|
}
|
|
|
|
NSString* path = [value stringByExpandingTildeInPath];
|
|
NSImage* icon;
|
|
//show a folder icon if the folder doesn't exist
|
|
if ([path.pathExtension isEqualToString:@""] && ![NSFileManager.defaultManager fileExistsAtPath:path])
|
|
{
|
|
icon = [NSWorkspace.sharedWorkspace iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)];
|
|
}
|
|
else
|
|
{
|
|
icon = [NSWorkspace.sharedWorkspace iconForFile:path];
|
|
}
|
|
|
|
icon.size = NSMakeSize(16.0, 16.0);
|
|
|
|
return icon;
|
|
}
|
|
|
|
@end
|