mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-25 02:29:49 +00:00
macroman_to_host_encoding - so it works the other way around too
This commit is contained in:
parent
ab86a395da
commit
f12f5173be
@ -438,3 +438,19 @@ const char *host_encoding_to_macroman(const char *filename)
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
// Convert from MacRoman to the host OS filename encoding
|
||||
const char *macroman_to_host_encoding(const char *filename)
|
||||
{
|
||||
static char filename_mr[64];
|
||||
CFStringRef sref = CFStringCreateWithCString(0, filename, kCFStringEncodingMacRoman);
|
||||
if (sref) {
|
||||
memset(filename_mr, 0, sizeof(filename_mr));
|
||||
if (CFStringGetCString(sref, filename_mr, sizeof(filename_mr), kCFStringEncodingUTF8)) {
|
||||
return filename_mr;
|
||||
}
|
||||
CFRelease(sref);
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
@ -382,3 +382,11 @@ const char *host_encoding_to_macroman(const char *filename)
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
|
||||
// Convert from MacRoman to host OS filename encoding
|
||||
const char *macroman_to_host_encoding(const char *filename)
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
|
@ -390,3 +390,10 @@ const char *host_encoding_to_macroman(const char *filename)
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
|
||||
// Convert from MacRoman to host OS filename encoding
|
||||
const char *macroman_to_host_encoding(const char *filename)
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ static FSItem *find_fsitem_guest(const char *guest_name, FSItem *parent)
|
||||
}
|
||||
|
||||
// Not found, construct new FSItem
|
||||
return create_fsitem(guest_name, guest_name, parent);
|
||||
return create_fsitem(macroman_to_host_encoding(guest_name), guest_name, parent);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -43,6 +43,7 @@ extern ssize_t extfs_write(int fd, void *buffer, size_t length);
|
||||
extern bool extfs_remove(const char *path);
|
||||
extern bool extfs_rename(const char *old_path, const char *new_path);
|
||||
extern const char *host_encoding_to_macroman(const char *filename); // What if the guest OS is using MacJapanese or MacArabic? Oh well...
|
||||
extern const char *macroman_to_host_encoding(const char *filename); // What if the guest OS is using MacJapanese or MacArabic? Oh well...
|
||||
|
||||
// Maximum length of full path name
|
||||
const int MAX_PATH_LENGTH = 1024;
|
||||
|
Loading…
Reference in New Issue
Block a user