File Tree: Attempt Unicode Normalization Form bodge on enumerated paths
parent
72f1168498
commit
38e013e4ab
|
@ -57,7 +57,48 @@ NSURL *resolveAliases(NSURL *url)
|
||||||
|
|
||||||
- (void)setURL:(NSURL *)u
|
- (void)setURL:(NSURL *)u
|
||||||
{
|
{
|
||||||
url = u;
|
// BODGE!
|
||||||
|
if (![[NSFileManager defaultManager] fileExistsAtPath:[u path]])
|
||||||
|
{
|
||||||
|
// Somebody gave us an incompatible file URL on enumeration!
|
||||||
|
DLog(@"Incompatible URL found: %@", [u path]);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
NSString * path = [u path];
|
||||||
|
NSString * bodge = [path precomposedStringWithCanonicalMapping];
|
||||||
|
if ([[NSFileManager defaultManager] fileExistsAtPath:bodge])
|
||||||
|
{
|
||||||
|
DLog(@"It's actually supposed to be NFC!");
|
||||||
|
u = [NSURL fileURLWithPath:bodge];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bodge = [path decomposedStringWithCanonicalMapping];
|
||||||
|
if ([[NSFileManager defaultManager] fileExistsAtPath:bodge])
|
||||||
|
{
|
||||||
|
DLog(@"It's actually supposed to be NFD!");
|
||||||
|
u = [NSURL fileURLWithPath:bodge];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bodge = [path precomposedStringWithCompatibilityMapping];
|
||||||
|
if ([[NSFileManager defaultManager] fileExistsAtPath:bodge])
|
||||||
|
{
|
||||||
|
DLog(@"It's actually supposed to be NFKC!");
|
||||||
|
u = [NSURL fileURLWithPath:bodge];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bodge = [path decomposedStringWithCompatibilityMapping];
|
||||||
|
if ([[NSFileManager defaultManager] fileExistsAtPath:bodge])
|
||||||
|
{
|
||||||
|
DLog(@"It's actually supposed to be NFKD!");
|
||||||
|
u = [NSURL fileURLWithPath:bodge];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DLog(@"No idea what's up with this path!");
|
||||||
|
}
|
||||||
|
while (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
url = u;
|
||||||
|
|
||||||
display = [[NSFileManager defaultManager] displayNameAtPath:[u path]];
|
display = [[NSFileManager defaultManager] displayNameAtPath:[u path]];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue