[vlc-commits] macosx: remove VLCStringUtility

Felix Paul Kühne git at videolan.org
Wed Jan 30 14:37:11 CET 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Wed Jan 30 14:33:03 2019 +0100| [7e9a5f16a7a14f733449f81842ad7b010d7f3d3f] | committer: Felix Paul Kühne

macosx: remove VLCStringUtility

Use C functions instead of an ObjC singleton for string operations and move all string related operators to a single header/implementation

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7e9a5f16a7a14f733449f81842ad7b010d7f3d3f
---

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |   8 +-
 modules/gui/macosx/Makefile.am                     |   1 -
 modules/gui/macosx/NSString+Helpers.h              |  59 ++-
 modules/gui/macosx/NSString+Helpers.m              | 338 +++++++++++++++++-
 modules/gui/macosx/VLCAddonListItem.m              |   2 +-
 modules/gui/macosx/VLCCoreInteraction.m            |   4 +-
 modules/gui/macosx/VLCErrorWindowController.m      |   2 +-
 modules/gui/macosx/VLCLibraryWindow.m              |   2 +-
 modules/gui/macosx/VLCMain+OldPrefs.m              |   2 +-
 modules/gui/macosx/VLCMain.h                       |   2 +-
 modules/gui/macosx/VLCMainMenu.m                   |  61 ++--
 modules/gui/macosx/VLCMainWindow.m                 |   4 +-
 modules/gui/macosx/VLCOpenWindowController.m       |   4 +-
 modules/gui/macosx/VLCPLModel.m                    |   2 +-
 modules/gui/macosx/VLCPlaylist.m                   |  10 +-
 modules/gui/macosx/VLCRendererItem.m               |   2 +-
 modules/gui/macosx/VLCResumeDialogController.m     |   2 +-
 modules/gui/macosx/VLCSimplePrefsController.m      |   6 +-
 modules/gui/macosx/VLCStringUtility.h              |  72 ----
 modules/gui/macosx/VLCStringUtility.m              | 395 ---------------------
 .../gui/macosx/VLCTimeSelectionPanelController.m   |   3 +-
 modules/gui/macosx/misc.m                          |   2 +-
 po/POTFILES.in                                     |   2 -
 23 files changed, 448 insertions(+), 537 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 651eafced9..b1e169337c 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -44,7 +44,6 @@
 		1C3113D51E508C6900D4DD76 /* VLCTextfieldPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = CC461F6D160078340022423C /* VLCTextfieldPanelController.m */; };
 		1C3113D71E508C6900D4DD76 /* VLCPopupPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C7CB91B1D787E7600388902 /* VLCPopupPanelController.m */; };
 		1C3113D91E508C6900D4DD76 /* VLCSimplePrefsController.m in Sources */ = {isa = PBXBuildFile; fileRef = CCB24D5D0D54BBAE004D780C /* VLCSimplePrefsController.m */; };
-		1C3113DB1E508C6900D4DD76 /* VLCStringUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = CC269A4715E7947F00F2FDC9 /* VLCStringUtility.m */; };
 		1C3113DD1E508C6900D4DD76 /* VLCTrackSynchronizationWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = CC707EC4137464CD0003010A /* VLCTrackSynchronizationWindowController.m */; };
 		1C3113DF1E508C6900D4DD76 /* VLCVideoEffectsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = CCCE366E13817E4500694F2A /* VLCVideoEffectsWindowController.m */; };
 		1C3113E11E508C6900D4DD76 /* VLCVoutView.m in Sources */ = {isa = PBXBuildFile; fileRef = CCCCDCA11413E1C000FE3DE1 /* VLCVoutView.m */; };
@@ -126,6 +125,7 @@
 		7D66D4392200C5B80040D04A /* VLCVideoFilterHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66D4382200C5B80040D04A /* VLCVideoFilterHelper.m */; };
 		7D66D43C2200D6090040D04A /* VLCDetachedVideoWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66D43B2200D6090040D04A /* VLCDetachedVideoWindow.m */; };
 		7D713D322201AE350042BEB7 /* VLCLibraryWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */; };
+		7D713D362201DC640042BEB7 /* VLCLibraryWindow.xib in Sources */ = {isa = PBXBuildFile; fileRef = 7D713D332201BB130042BEB7 /* VLCLibraryWindow.xib */; };
 		7DB40D2A20CBCEB500F63173 /* VLCMainMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DB40D2920CBCEB500F63173 /* VLCMainMenu.m */; };
 		7DB40D2D20CBCEC200F63173 /* VLCStatusBarIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DB40D2B20CBCEC200F63173 /* VLCStatusBarIcon.m */; };
 		7DB7F1EC20CC036D00C2CAED /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DB7F1EB20CC036D00C2CAED /* AudioUnit.framework */; };
@@ -515,8 +515,6 @@
 		CC0663341566C34C003A411C /* VLCConvertAndSaveWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VLCConvertAndSaveWindowController.h; sourceTree = "<group>"; };
 		CC0663351566C34C003A411C /* VLCConvertAndSaveWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = VLCConvertAndSaveWindowController.m; sourceTree = "<group>"; };
 		CC1941240B9C1F8400635F6B /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = "<absolute>"; };
-		CC269A4615E7947F00F2FDC9 /* VLCStringUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCStringUtility.h; sourceTree = "<group>"; };
-		CC269A4715E7947F00F2FDC9 /* VLCStringUtility.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCStringUtility.m; sourceTree = "<group>"; };
 		CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
 		CC426FD01020D44F00A32659 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = ../../../contrib/Sparkle.framework; sourceTree = SOURCE_ROOT; };
 		CC448A6013B68A0B009F72E0 /* VLCCoreInteraction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCCoreInteraction.h; sourceTree = "<group>"; };
@@ -1008,8 +1006,6 @@
 				7D871D391B5E684D000B56C0 /* helpers.h */,
 				8ED6C27F03E2EB1C0059A3A7 /* misc.h */,
 				8ED6C28003E2EB1C0059A3A7 /* misc.m */,
-				CC269A4615E7947F00F2FDC9 /* VLCStringUtility.h */,
-				CC269A4715E7947F00F2FDC9 /* VLCStringUtility.m */,
 				6B397C4D216C8EB200403ED0 /* NSString+Helpers.h */,
 				6B397C4E216C8EB200403ED0 /* NSString+Helpers.m */,
 				6B7F1FDD1F07DA920002BDD8 /* VLCHexNumberFormatter.h */,
@@ -1608,6 +1604,7 @@
 			files = (
 				1CCC88EC2078A3D500E5626F /* MainMenu.xib in Sources */,
 				1CCC88ED2078A3D500E5626F /* MainWindow.xib in Sources */,
+				7D713D362201DC640042BEB7 /* VLCLibraryWindow.xib in Sources */,
 				1CCC88EE2078A3D500E5626F /* VLCStatusBarIconMainMenu.xib in Sources */,
 				1CCC88EF2078A3D500E5626F /* VLCFullScreenPanel.xib in Sources */,
 				1CCC88F02078A3D500E5626F /* About.xib in Sources */,
@@ -1713,7 +1710,6 @@
 				6B8A6B0221279D2600DC29F3 /* PXSourceList.m in Sources */,
 				6B2EFC601F2819F700F3C0EA /* VLCVolumeSlider.m in Sources */,
 				7D2E0EDB20CD204D0033A221 /* VLCWindow.m in Sources */,
-				1C3113DB1E508C6900D4DD76 /* VLCStringUtility.m in Sources */,
 				6B4D50A71E7AB52C004479B5 /* NSScreen+VLCAdditions.m in Sources */,
 				6B8A6AFD21279D2600DC29F3 /* PXSourceListBadgeView.m in Sources */,
 				1C3113DD1E508C6900D4DD76 /* VLCTrackSynchronizationWindowController.m in Sources */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 957202e4b4..6544d5f260 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -70,7 +70,6 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/VLCHotkeyChangeWindow.h gui/macosx/VLCHotkeyChangeWindow.m \
 	gui/macosx/SPMediaKeyTap.h gui/macosx/SPMediaKeyTap.m \
 	gui/macosx/Spotify.h \
-	gui/macosx/VLCStringUtility.h gui/macosx/VLCStringUtility.m \
 	gui/macosx/VLCVoutView.h gui/macosx/VLCVoutView.m \
 	gui/macosx/VLCTimeSelectionPanelController.h gui/macosx/VLCTimeSelectionPanelController.m \
 	gui/macosx/VLCUIWidgets.h gui/macosx/VLCUIWidgets.m \
diff --git a/modules/gui/macosx/NSString+Helpers.h b/modules/gui/macosx/NSString+Helpers.h
index e7718e1039..7c2da8e7e1 100644
--- a/modules/gui/macosx/NSString+Helpers.h
+++ b/modules/gui/macosx/NSString+Helpers.h
@@ -1,13 +1,14 @@
 /*****************************************************************************
  * NSString+Helpers.h: Category with helper functions for NSStrings
  *****************************************************************************
- * Copyright (C) 2002-2018 VLC authors and VideoLAN
+ * Copyright (C) 2002-2019 VLC authors and VideoLAN
  *
  * Authors: Jon Lech Johansen <jon-vl at nanocrew.net>
  *          Christophe Massiot <massiot at via.ecp.fr>
  *          Derk-Jan Hartman <hartman at videolan dot org>
  *          Felix Paul Kühne <fkuehne at videolan dot org>
  *          Marvin Scholz <epirat07 at gmail.com>
+ *          David Fuhrmann <dfuhrmann # videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,9 +25,42 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Foundation/Foundation.h>
+#import <Cocoa/Cocoa.h>
 #import <vlc_input.h>
 
+#define _NS(s) ((s) ? toNSStr(vlc_gettext(s)) : @"")
+
+/* Get an alternate version of the string.
+ * This string is stored as '1:string' but when displayed it only displays
+ * the translated string. the translation should be '1:translatedstring' though */
+#define _ANS(s) [((s) ? toNSStr(vlc_gettext(s)) : @"") substringFromIndex:2]
+
+extern NSString *const kVLCMediaAudioCD;
+extern NSString *const kVLCMediaDVD;
+extern NSString *const kVLCMediaVCD;
+extern NSString *const kVLCMediaSVCD;
+extern NSString *const kVLCMediaBD;
+extern NSString *const kVLCMediaVideoTSFolder;
+extern NSString *const kVLCMediaBDMVFolder;
+extern NSString *const kVLCMediaUnknown;
+
+NSString *toNSStr(const char *str);
+
+/**
+ * Takes the first value of an cocoa key string, and converts it to VLCs int representation.
+ */
+unsigned int CocoaKeyToVLC(unichar i_key);
+
+/**
+ * Fix certain settings strings before saving
+ */
+bool fixIntfSettings(void);
+
+/**
+ * Gets an image resource
+ */
+NSImage *imageFromRes(NSString *name);
+
 @interface NSString (Helpers)
 
 /**
@@ -116,3 +150,24 @@ static inline NSString *B64EncAndFree(char *cs) {
 
     return (res == nil) ? @"" : res;
 }
+
+NSString * getVolumeTypeFromMountPath(NSString *mountPath);
+
+NSString * getBSDNodeFromMountPath(NSString *mountPath);
+
+/**
+ * Converts VLC key string to a prettified version, for hotkey settings.
+ * The returned string adapts similar how its done within the cocoa framework when setting this
+ * key to menu items.
+ */
+NSString * OSXStringKeyToString(NSString *theString);
+
+/**
+ * Converts VLC key string to cocoa modifiers which can be used as setKeyEquivalent for menu items
+ */
+NSString * VLCKeyToString(NSString *theString);
+
+/**
+ * Converts VLC key to cocoa string which can be used as setKeyEquivalentModifierMask for menu items
+ */
+unsigned int VLCModifiersToCocoa(NSString *theString);
diff --git a/modules/gui/macosx/NSString+Helpers.m b/modules/gui/macosx/NSString+Helpers.m
index 09bef3c696..5db9a1a012 100644
--- a/modules/gui/macosx/NSString+Helpers.m
+++ b/modules/gui/macosx/NSString+Helpers.m
@@ -1,13 +1,14 @@
 /*****************************************************************************
  * NSString+Helpers.m: Category with helper functions for NSStrings
  *****************************************************************************
- * Copyright (C) 2002-2018 VLC authors and VideoLAN
+ * Copyright (C) 2002-2019 VLC authors and VideoLAN
  *
  * Authors: Jon Lech Johansen <jon-vl at nanocrew.net>
  *          Christophe Massiot <massiot at via.ecp.fr>
  *          Derk-Jan Hartman <hartman at videolan dot org>
  *          Felix Paul Kühne <fkuehne at videolan dot org>
  *          Marvin Scholz <epirat07 at gmail.com>
+ *          David Fuhrmann <dfuhrmann # videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,10 +26,26 @@
  *****************************************************************************/
 
 #import "NSString+Helpers.h"
-#import <Cocoa/Cocoa.h>
 
-#import <vlc_common.h>
 #import <vlc_strings.h>
+#import <vlc_actions.h>
+
+#import <sys/param.h>
+#import <sys/mount.h>
+
+#import <IOKit/storage/IOMedia.h>
+#import <IOKit/storage/IOCDMedia.h>
+#import <IOKit/storage/IODVDMedia.h>
+#import <IOKit/storage/IOBDMedia.h>
+
+NSString *const kVLCMediaAudioCD = @"AudioCD";
+NSString *const kVLCMediaDVD = @"DVD";
+NSString *const kVLCMediaVCD = @"VCD";
+NSString *const kVLCMediaSVCD = @"SVCD";
+NSString *const kVLCMediaBD = @"Blu-ray";
+NSString *const kVLCMediaVideoTSFolder = @"VIDEO_TS";
+NSString *const kVLCMediaBDMVFolder = @"BDMV";
+NSString *const kVLCMediaUnknown = @"Unknown";
 
 @implementation NSString (Helpers)
 
@@ -155,3 +172,318 @@
 }
 
 @end
+
+#pragma mark -
+#pragma mark Key Shortcuts
+
+static struct
+{
+    unichar i_nskey;
+    unsigned int i_vlckey;
+} nskeys_to_vlckeys[] =
+{
+    { NSUpArrowFunctionKey, KEY_UP },
+    { NSDownArrowFunctionKey, KEY_DOWN },
+    { NSLeftArrowFunctionKey, KEY_LEFT },
+    { NSRightArrowFunctionKey, KEY_RIGHT },
+    { NSF1FunctionKey, KEY_F1 },
+    { NSF2FunctionKey, KEY_F2 },
+    { NSF3FunctionKey, KEY_F3 },
+    { NSF4FunctionKey, KEY_F4 },
+    { NSF5FunctionKey, KEY_F5 },
+    { NSF6FunctionKey, KEY_F6 },
+    { NSF7FunctionKey, KEY_F7 },
+    { NSF8FunctionKey, KEY_F8 },
+    { NSF9FunctionKey, KEY_F9 },
+    { NSF10FunctionKey, KEY_F10 },
+    { NSF11FunctionKey, KEY_F11 },
+    { NSF12FunctionKey, KEY_F12 },
+    { NSInsertFunctionKey, KEY_INSERT },
+    { NSHomeFunctionKey, KEY_HOME },
+    { NSEndFunctionKey, KEY_END },
+    { NSPageUpFunctionKey, KEY_PAGEUP },
+    { NSPageDownFunctionKey, KEY_PAGEDOWN },
+    { NSMenuFunctionKey, KEY_MENU },
+    { NSTabCharacter, KEY_TAB },
+    { NSCarriageReturnCharacter, KEY_ENTER },
+    { NSEnterCharacter, KEY_ENTER },
+    { NSBackspaceCharacter, KEY_BACKSPACE },
+    { NSDeleteCharacter, KEY_DELETE },
+    {0,0}
+};
+
+unsigned int CocoaKeyToVLC(unichar i_key)
+{
+    unsigned int i;
+
+    for (i = 0; nskeys_to_vlckeys[i].i_nskey != 0; i++) {
+        if (nskeys_to_vlckeys[i].i_nskey == i_key) {
+            return nskeys_to_vlckeys[i].i_vlckey;
+        }
+    }
+    return (unsigned int)i_key;
+}
+
+/* takes a good old const c string and converts it to NSString without UTF8 loss */
+
+NSString *toNSStr(const char *str) {
+    return str != NULL ? [NSString stringWithUTF8String:str] : @"";
+}
+
+NSImage *imageFromRes(NSString *name)
+{
+    return [NSImage imageNamed:name];
+}
+
+bool fixIntfSettings(void)
+{
+    NSMutableString * o_workString;
+    NSRange returnedRange;
+    NSRange fullRange;
+    BOOL b_needsRestart = NO;
+
+    #define fixpref(pref) \
+    o_workString = [[NSMutableString alloc] initWithFormat:@"%s", config_GetPsz(pref)]; \
+    if ([o_workString length] > 0) \
+    { \
+        returnedRange = [o_workString rangeOfString:@"macosx" options: NSCaseInsensitiveSearch]; \
+        if (returnedRange.location != NSNotFound) \
+        { \
+            if ([o_workString isEqualToString:@"macosx"]) \
+                [o_workString setString:@""]; \
+            fullRange = NSMakeRange(0, [o_workString length]); \
+            [o_workString replaceOccurrencesOfString:@":macosx" withString:@"" options: NSCaseInsensitiveSearch range: fullRange]; \
+            fullRange = NSMakeRange(0, [o_workString length]); \
+            [o_workString replaceOccurrencesOfString:@"macosx:" withString:@"" options: NSCaseInsensitiveSearch range: fullRange]; \
+            \
+            config_PutPsz(pref, [o_workString UTF8String]); \
+            b_needsRestart = YES; \
+        } \
+    }
+
+    fixpref("control");
+    fixpref("extraintf");
+#undef fixpref
+
+    return b_needsRestart;
+}
+
+NSString * getVolumeTypeFromMountPath(NSString *mountPath)
+{
+    struct statfs stf;
+    int ret = statfs([mountPath fileSystemRepresentation], &stf);
+    if (ret != 0) {
+        return @"";
+    }
+
+    CFMutableDictionaryRef matchingDict = IOBSDNameMatching(kIOMasterPortDefault, 0, stf.f_mntfromname);
+    io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict);
+    NSString *returnValue;
+
+    if (IO_OBJECT_NULL != service) {
+        if (IOObjectConformsTo(service, kIOCDMediaClass))
+            returnValue = kVLCMediaAudioCD;
+        else if (IOObjectConformsTo(service, kIODVDMediaClass))
+            returnValue = kVLCMediaDVD;
+        else if (IOObjectConformsTo(service, kIOBDMediaClass))
+            returnValue = kVLCMediaBD;
+        IOObjectRelease(service);
+
+        if (returnValue)
+            return returnValue;
+    }
+
+    out:
+    if ([mountPath rangeOfString:@"VIDEO_TS" options:NSCaseInsensitiveSearch | NSBackwardsSearch].location != NSNotFound)
+        returnValue = kVLCMediaVideoTSFolder;
+        else if ([mountPath rangeOfString:@"BDMV" options:NSCaseInsensitiveSearch | NSBackwardsSearch].location != NSNotFound)
+            returnValue = kVLCMediaBDMVFolder;
+            else {
+                // NSFileManager is not thread-safe, don't use defaultManager outside of the main thread
+                NSFileManager * fm = [[NSFileManager alloc] init];
+
+                NSArray *dirContents = [fm contentsOfDirectoryAtPath:mountPath error:nil];
+                for (int i = 0; i < [dirContents count]; i++) {
+                    NSString *currentFile = [dirContents objectAtIndex:i];
+                    NSString *fullPath = [mountPath stringByAppendingPathComponent:currentFile];
+
+                    BOOL isDir;
+                    if ([fm fileExistsAtPath:fullPath isDirectory:&isDir] && isDir)
+                    {
+                        if ([currentFile caseInsensitiveCompare:@"SVCD"] == NSOrderedSame) {
+                            returnValue = kVLCMediaSVCD;
+                            break;
+                        }
+                        if ([currentFile caseInsensitiveCompare:@"VCD"] == NSOrderedSame) {
+                            returnValue = kVLCMediaVCD;
+                            break;
+                        }
+                        if ([currentFile caseInsensitiveCompare:@"BDMV"] == NSOrderedSame) {
+                            returnValue = kVLCMediaBDMVFolder;
+                            break;
+                        }
+                        if ([currentFile caseInsensitiveCompare:@"VIDEO_TS"] == NSOrderedSame) {
+                            returnValue = kVLCMediaVideoTSFolder;
+                            break;
+                        }
+                    }
+                }
+
+                if (!returnValue)
+                    returnValue = kVLCMediaVideoTSFolder;
+            }
+
+    return returnValue;
+}
+
+NSString * getBSDNodeFromMountPath(NSString *mountPath)
+{
+    struct statfs stf;
+    int ret = statfs([mountPath fileSystemRepresentation], &stf);
+    if (ret != 0) {
+        return @"";
+    }
+
+    return [NSString stringWithFormat:@"r%s", stf.f_mntfromname];
+}
+
+NSString * OSXStringKeyToString(NSString *theString)
+{
+    if (![theString isEqualToString:@""]) {
+        /* remove cruft */
+        if ([theString characterAtIndex:([theString length] - 1)] != 0x2b)
+            theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
+        else {
+            theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
+            theString = [NSString stringWithFormat:@"%@+", theString];
+        }
+        if ([theString characterAtIndex:([theString length] - 1)] != 0x2d)
+            theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
+        else {
+            theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
+            theString = [NSString stringWithFormat:@"%@-", theString];
+        }
+        /* modifiers */
+        theString = [theString stringByReplacingOccurrencesOfString:@"Command" withString: [NSString stringWithUTF8String:"\xE2\x8C\x98"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Alt" withString: [NSString stringWithUTF8String:"\xE2\x8C\xA5"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Shift" withString: [NSString stringWithUTF8String:"\xE2\x87\xA7"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Ctrl" withString: [NSString stringWithUTF8String:"\xE2\x8C\x83"]];
+        /* show non-character keys correctly */
+        theString = [theString stringByReplacingOccurrencesOfString:@"Right" withString:[NSString stringWithUTF8String:"\xE2\x86\x92"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Left" withString:[NSString stringWithUTF8String:"\xE2\x86\x90"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Page Up" withString:[NSString stringWithUTF8String:"\xE2\x87\x9E"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Page Down" withString:[NSString stringWithUTF8String:"\xE2\x87\x9F"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Up" withString:[NSString stringWithUTF8String:"\xE2\x86\x91"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Down" withString:[NSString stringWithUTF8String:"\xE2\x86\x93"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Enter" withString:[NSString stringWithUTF8String:"\xe2\x86\xb5"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Tab" withString:[NSString stringWithUTF8String:"\xe2\x87\xa5"]];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Delete" withString:[NSString stringWithUTF8String:"\xe2\x8c\xab"]];        /* capitalize plain characters to suit the menubar's look */
+        theString = [theString capitalizedString];
+    }
+    else
+        theString = [NSString stringWithString:_NS("Not Set")];
+    return theString;
+}
+
+NSString * VLCKeyToString(NSString *theString)
+{
+    if (![theString isEqualToString:@""]) {
+        if ([theString characterAtIndex:([theString length] - 1)] != 0x2b)
+            theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
+        else {
+            theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
+            theString = [NSString stringWithFormat:@"%@+", theString];
+        }
+        if ([theString characterAtIndex:([theString length] - 1)] != 0x2d)
+            theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
+        else {
+            theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
+            theString = [NSString stringWithFormat:@"%@-", theString];
+        }
+        theString = [theString stringByReplacingOccurrencesOfString:@"Command" withString:@""];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Alt" withString:@""];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Shift" withString:@""];
+        theString = [theString stringByReplacingOccurrencesOfString:@"Ctrl" withString:@""];
+    }
+
+#ifdef __clang__
+#pragma GCC diagnostic ignored "-Wformat"
+#endif
+    if ([theString length] > 1) {
+        if ([theString rangeOfString:@"Page Up"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSPageUpFunctionKey];
+        else if ([theString rangeOfString:@"Page Down"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSPageDownFunctionKey];
+        else if ([theString rangeOfString:@"Up"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSUpArrowFunctionKey];
+        else if ([theString rangeOfString:@"Down"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSDownArrowFunctionKey];
+        else if ([theString rangeOfString:@"Right"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSRightArrowFunctionKey];
+        else if ([theString rangeOfString:@"Left"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSLeftArrowFunctionKey];
+        else if ([theString rangeOfString:@"Enter"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSEnterCharacter]; // we treat NSCarriageReturnCharacter as aquivalent
+        else if ([theString rangeOfString:@"Insert"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSInsertFunctionKey];
+        else if ([theString rangeOfString:@"Home"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSHomeFunctionKey];
+        else if ([theString rangeOfString:@"End"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSEndFunctionKey];
+        else if ([theString rangeOfString:@"Menu"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSMenuFunctionKey];
+        else if ([theString rangeOfString:@"Tab"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSTabCharacter];
+        else if ([theString rangeOfString:@"Backspace"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSBackspaceCharacter];
+        else if ([theString rangeOfString:@"Delete"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSDeleteCharacter];
+        else if ([theString rangeOfString:@"F12"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF12FunctionKey];
+        else if ([theString rangeOfString:@"F11"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF11FunctionKey];
+        else if ([theString rangeOfString:@"F10"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF10FunctionKey];
+        else if ([theString rangeOfString:@"F9"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF9FunctionKey];
+        else if ([theString rangeOfString:@"F8"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF8FunctionKey];
+        else if ([theString rangeOfString:@"F7"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF7FunctionKey];
+        else if ([theString rangeOfString:@"F6"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF6FunctionKey];
+        else if ([theString rangeOfString:@"F5"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF5FunctionKey];
+        else if ([theString rangeOfString:@"F4"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF4FunctionKey];
+        else if ([theString rangeOfString:@"F3"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF3FunctionKey];
+        else if ([theString rangeOfString:@"F2"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF2FunctionKey];
+        else if ([theString rangeOfString:@"F1"].location != NSNotFound)
+            return [NSString stringWithFormat:@"%C", NSF1FunctionKey];
+        else if ([theString rangeOfString:@"Space"].location != NSNotFound)
+            return @" ";
+        /* note that we don't support esc here, since it is reserved for leaving fullscreen */
+    }
+#ifdef __clang__
+#pragma GCC diagnostic warning "-Wformat"
+#endif
+
+    return theString;
+}
+
+unsigned int VLCModifiersToCocoa(NSString *theString)
+{
+    unsigned int new = 0;
+
+    if ([theString rangeOfString:@"Command"].location != NSNotFound)
+        new |= NSCommandKeyMask;
+    if ([theString rangeOfString:@"Alt"].location != NSNotFound)
+        new |= NSAlternateKeyMask;
+    if ([theString rangeOfString:@"Shift"].location != NSNotFound)
+        new |= NSShiftKeyMask;
+    if ([theString rangeOfString:@"Ctrl"].location != NSNotFound)
+        new |= NSControlKeyMask;
+    return new;
+}
diff --git a/modules/gui/macosx/VLCAddonListItem.m b/modules/gui/macosx/VLCAddonListItem.m
index d23150c4ac..de09a684e8 100644
--- a/modules/gui/macosx/VLCAddonListItem.m
+++ b/modules/gui/macosx/VLCAddonListItem.m
@@ -22,7 +22,7 @@
 
 #import "VLCMain.h"
 #import "VLCAddonListItem.h"
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 
 @interface VLCAddonListItem ()
 {
diff --git a/modules/gui/macosx/VLCCoreInteraction.m b/modules/gui/macosx/VLCCoreInteraction.m
index 9ae0635273..7c0462434b 100644
--- a/modules/gui/macosx/VLCCoreInteraction.m
+++ b/modules/gui/macosx/VLCCoreInteraction.m
@@ -787,9 +787,9 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
         NSUInteger numberOfUsedHotkeys = [_usedHotkeys count];
         for (NSUInteger i = 0; i < numberOfUsedHotkeys; i++) {
             NSString *str = [_usedHotkeys objectAtIndex:i];
-            unsigned int i_keyModifiers = [[VLCStringUtility sharedInstance] VLCModifiersToCocoa: str];
+            unsigned int i_keyModifiers = VLCModifiersToCocoa(str);
 
-            if ([[characters lowercaseString] isEqualToString: [[VLCStringUtility sharedInstance] VLCKeyToString: str]] &&
+            if ([[characters lowercaseString] isEqualToString: VLCKeyToString(str)] &&
                 (i_keyModifiers & NSShiftKeyMask)     == (i_pressed_modifiers & NSShiftKeyMask) &&
                 (i_keyModifiers & NSControlKeyMask)   == (i_pressed_modifiers & NSControlKeyMask) &&
                 (i_keyModifiers & NSAlternateKeyMask) == (i_pressed_modifiers & NSAlternateKeyMask) &&
diff --git a/modules/gui/macosx/VLCErrorWindowController.m b/modules/gui/macosx/VLCErrorWindowController.m
index de496eb644..145f4dbaae 100644
--- a/modules/gui/macosx/VLCErrorWindowController.m
+++ b/modules/gui/macosx/VLCErrorWindowController.m
@@ -23,7 +23,7 @@
 
 #import "VLCErrorWindowController.h"
 
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 
 
 @interface VLCErrorWindowController()
diff --git a/modules/gui/macosx/VLCLibraryWindow.m b/modules/gui/macosx/VLCLibraryWindow.m
index b6976ef86d..455cd19851 100644
--- a/modules/gui/macosx/VLCLibraryWindow.m
+++ b/modules/gui/macosx/VLCLibraryWindow.m
@@ -21,7 +21,7 @@
  *****************************************************************************/
 
 #import "VLCLibraryWindow.h"
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 
 static const float f_min_window_width = 604.;
 static const float f_min_window_height = 307.;
diff --git a/modules/gui/macosx/VLCMain+OldPrefs.m b/modules/gui/macosx/VLCMain+OldPrefs.m
index 8a5b83666f..54f49be9a8 100644
--- a/modules/gui/macosx/VLCMain+OldPrefs.m
+++ b/modules/gui/macosx/VLCMain+OldPrefs.m
@@ -25,7 +25,7 @@
 #import "VLCMain+OldPrefs.h"
 #import "VLCCoreInteraction.h"
 #import "VLCSimplePrefsController.h"
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 
 #include <unistd.h> /* execl() */
 
diff --git a/modules/gui/macosx/VLCMain.h b/modules/gui/macosx/VLCMain.h
index 16158e8d0f..7863d1f497 100644
--- a/modules/gui/macosx/VLCMain.h
+++ b/modules/gui/macosx/VLCMain.h
@@ -41,7 +41,7 @@
 #import "VLCMainWindow.h"
 #import "VLCVideoOutputProvider.h"
 #import "VLCStatusBarIcon.h"
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 
 /*****************************************************************************
  * Local prototypes.
diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index 7a7c3c201f..40ef951411 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -106,7 +106,6 @@
 #endif
 
     NSString* keyString;
-    VLCStringUtility *stringUtility = [VLCStringUtility sharedInstance];
     char *key;
 
     /* Get ExtensionsManager */
@@ -116,94 +115,94 @@
 
     key = config_GetPsz("key-quit");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_quit setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_quit setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_quit setKeyEquivalent: VLCKeyToString(keyString)];
+    [_quit setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     // do not assign play/pause key
 
     key = config_GetPsz("key-stop");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_stop setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_stop setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_stop setKeyEquivalent: VLCKeyToString(keyString)];
+    [_stop setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-prev");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_previous setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_previous setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_previous setKeyEquivalent: VLCKeyToString(keyString)];
+    [_previous setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-next");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_next setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_next setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_next setKeyEquivalent: VLCKeyToString(keyString)];
+    [_next setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-jump+short");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_fwd setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_fwd setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_fwd setKeyEquivalent: VLCKeyToString(keyString)];
+    [_fwd setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-jump-short");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_bwd setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_bwd setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_bwd setKeyEquivalent: VLCKeyToString(keyString)];
+    [_bwd setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-vol-up");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_vol_up setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_vol_up setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_vol_up setKeyEquivalent: VLCKeyToString(keyString)];
+    [_vol_up setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-vol-down");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_vol_down setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_vol_down setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_vol_down setKeyEquivalent: VLCKeyToString(keyString)];
+    [_vol_down setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-vol-mute");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_mute setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_mute setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_mute setKeyEquivalent: VLCKeyToString(keyString)];
+    [_mute setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-toggle-fullscreen");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_fullscreenItem setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_fullscreenItem setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_fullscreenItem setKeyEquivalent: VLCKeyToString(keyString)];
+    [_fullscreenItem setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-snapshot");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_snapshot setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_snapshot setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_snapshot setKeyEquivalent: VLCKeyToString(keyString)];
+    [_snapshot setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-random");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_random setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_random setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_random setKeyEquivalent: VLCKeyToString(keyString)];
+    [_random setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-zoom-half");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_half_window setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_half_window setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_half_window setKeyEquivalent: VLCKeyToString(keyString)];
+    [_half_window setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-zoom-original");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_normal_window setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_normal_window setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_normal_window setKeyEquivalent: VLCKeyToString(keyString)];
+    [_normal_window setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     key = config_GetPsz("key-zoom-double");
     keyString = [NSString stringWithFormat:@"%s", key];
-    [_double_window setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
-    [_double_window setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
+    [_double_window setKeyEquivalent: VLCKeyToString(keyString)];
+    [_double_window setKeyEquivalentModifierMask: VLCModifiersToCocoa(keyString)];
     FREENULL(key);
 
     [self setSubmenusEnabled: FALSE];
diff --git a/modules/gui/macosx/VLCMainWindow.m b/modules/gui/macosx/VLCMainWindow.m
index c29eaecf3d..1339a5d860 100644
--- a/modules/gui/macosx/VLCMainWindow.m
+++ b/modules/gui/macosx/VLCMainWindow.m
@@ -96,11 +96,11 @@ static const float f_min_window_height = 307.;
     o_key = [NSString stringWithFormat:@"%s", key];
     FREENULL(key);
 
-    unsigned int i_keyModifiers = [[VLCStringUtility sharedInstance] VLCModifiersToCocoa:o_key];
+    unsigned int i_keyModifiers = VLCModifiersToCocoa(o_key);
 
     NSString * characters = [o_event charactersIgnoringModifiers];
     if ([characters length] > 0) {
-        return [[characters lowercaseString] isEqualToString: [[VLCStringUtility sharedInstance] VLCKeyToString: o_key]] &&
+        return [[characters lowercaseString] isEqualToString: VLCKeyToString(o_key)] &&
                 (i_keyModifiers & NSShiftKeyMask)     == ([o_event modifierFlags] & NSShiftKeyMask) &&
                 (i_keyModifiers & NSControlKeyMask)   == ([o_event modifierFlags] & NSControlKeyMask) &&
                 (i_keyModifiers & NSAlternateKeyMask) == ([o_event modifierFlags] & NSAlternateKeyMask) &&
diff --git a/modules/gui/macosx/VLCOpenWindowController.m b/modules/gui/macosx/VLCOpenWindowController.m
index 714827df19..3ad907e334 100644
--- a/modules/gui/macosx/VLCOpenWindowController.m
+++ b/modules/gui/macosx/VLCOpenWindowController.m
@@ -783,7 +783,7 @@ static NSString *kCaptureTabViewId  = @"capture";
 {
     NSString *path = [url path];
 
-    NSString *type = [[VLCStringUtility sharedInstance] getVolumeTypeFromMountPath:path];
+    NSString *type = getVolumeTypeFromMountPath(path);
     NSImage *image = [[NSWorkspace sharedWorkspace] iconForFile: path];
     NSString *devicePath;
 
@@ -800,7 +800,7 @@ static NSString *kCaptureTabViewId  = @"capture";
         [type isEqualToString: kVLCMediaUnknown])
         devicePath = path;
     else
-        devicePath = [[VLCStringUtility sharedInstance] getBSDNodeFromMountPath:path];
+        devicePath = getBSDNodeFromMountPath(path);
 
     return [NSDictionary dictionaryWithObjectsAndKeys: path, @"path",
             devicePath, @"devicePath",
diff --git a/modules/gui/macosx/VLCPLModel.m b/modules/gui/macosx/VLCPLModel.m
index 9678cd2ab1..f199a394ee 100644
--- a/modules/gui/macosx/VLCPLModel.m
+++ b/modules/gui/macosx/VLCPLModel.m
@@ -23,7 +23,7 @@
 #import "misc.h"    /* VLCByteCountFormatter */
 
 #import "VLCPlaylist.h"
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 #import "VLCMain.h"
 #import "VLCMainWindowControlsBar.h"
 #import "VLCMainMenu.h"
diff --git a/modules/gui/macosx/VLCPlaylist.m b/modules/gui/macosx/VLCPlaylist.m
index 51981725ab..af526615b0 100644
--- a/modules/gui/macosx/VLCPlaylist.m
+++ b/modules/gui/macosx/VLCPlaylist.m
@@ -529,19 +529,19 @@
         [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:path isRemovable: &b_rem
                                                      isWritable:&b_writable isUnmountable:NULL description:NULL type:NULL] && b_rem && !b_writable && [url isFileURL]) {
 
-        NSString *diskType = [[VLCStringUtility sharedInstance] getVolumeTypeFromMountPath: path];
+        NSString *diskType = getVolumeTypeFromMountPath(path);
         msg_Dbg(p_intf, "detected optical media of type %s in the file input", [diskType UTF8String]);
 
         if ([diskType isEqualToString: kVLCMediaDVD])
-            uri = [NSString stringWithFormat: @"dvdnav://%@", [[VLCStringUtility sharedInstance] getBSDNodeFromMountPath: path]];
+            uri = [NSString stringWithFormat: @"dvdnav://%@", getBSDNodeFromMountPath(path)];
         else if ([diskType isEqualToString: kVLCMediaVideoTSFolder])
             uri = [NSString stringWithFormat: @"dvdnav://%@", path];
         else if ([diskType isEqualToString: kVLCMediaAudioCD])
-            uri = [NSString stringWithFormat: @"cdda://%@", [[VLCStringUtility sharedInstance] getBSDNodeFromMountPath: path]];
+            uri = [NSString stringWithFormat: @"cdda://%@", getBSDNodeFromMountPath(path)];
         else if ([diskType isEqualToString: kVLCMediaVCD])
-            uri = [NSString stringWithFormat: @"vcd://%@#0:0", [[VLCStringUtility sharedInstance] getBSDNodeFromMountPath: path]];
+            uri = [NSString stringWithFormat: @"vcd://%@#0:0", getBSDNodeFromMountPath(path)];
         else if ([diskType isEqualToString: kVLCMediaSVCD])
-            uri = [NSString stringWithFormat: @"vcd://%@@0:0", [[VLCStringUtility sharedInstance] getBSDNodeFromMountPath: path]];
+            uri = [NSString stringWithFormat: @"vcd://%@@0:0", getBSDNodeFromMountPath(path)];
         else if ([diskType isEqualToString: kVLCMediaBD] || [diskType isEqualToString: kVLCMediaBDMVFolder])
             uri = [NSString stringWithFormat: @"bluray://%@", path];
         else
diff --git a/modules/gui/macosx/VLCRendererItem.m b/modules/gui/macosx/VLCRendererItem.m
index 0f590c348a..939d2e2645 100644
--- a/modules/gui/macosx/VLCRendererItem.m
+++ b/modules/gui/macosx/VLCRendererItem.m
@@ -21,7 +21,7 @@
  *****************************************************************************/
 
 #import "VLCRendererItem.h"
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 
 #include <vlc_common.h>
 #include <vlc_renderer_discovery.h>
diff --git a/modules/gui/macosx/VLCResumeDialogController.m b/modules/gui/macosx/VLCResumeDialogController.m
index 4ddc2e0f6a..024ed03747 100644
--- a/modules/gui/macosx/VLCResumeDialogController.m
+++ b/modules/gui/macosx/VLCResumeDialogController.m
@@ -25,7 +25,7 @@
 #import "VLCResumeDialogController.h"
 
 #import "VLCMain.h"
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 #import "NSString+Helpers.h"
 
 @interface VLCResumeDialogController()
diff --git a/modules/gui/macosx/VLCSimplePrefsController.m b/modules/gui/macosx/VLCSimplePrefsController.m
index 96b1d62833..5f1d1c3726 100644
--- a/modules/gui/macosx/VLCSimplePrefsController.m
+++ b/modules/gui/macosx/VLCSimplePrefsController.m
@@ -1353,7 +1353,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
     if (sender == _hotkeys_changeButton || sender == _hotkeys_listbox) {
         [_hotkeys_changeLabel setStringValue: [NSString stringWithFormat: _NS("Press new keys for\n\"%@\""),
                                                [_hotkeyDescriptions objectAtIndex:[_hotkeys_listbox selectedRow]]]];
-        [_hotkeys_change_keysLabel setStringValue: [[VLCStringUtility sharedInstance] OSXStringKeyToString:[_hotkeySettings objectAtIndex:[_hotkeys_listbox selectedRow]]]];
+        [_hotkeys_change_keysLabel setStringValue: OSXStringKeyToString([_hotkeySettings objectAtIndex:[_hotkeys_listbox selectedRow]])];
         [_hotkeys_change_takenLabel setStringValue: @""];
         [_hotkeys_change_win setInitialFirstResponder: [_hotkeys_change_win contentView]];
         [_hotkeys_change_win makeFirstResponder: [_hotkeys_change_win contentView]];
@@ -1411,7 +1411,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
     if ([identifier isEqualToString: @"action"])
         return [_hotkeyDescriptions objectAtIndex:rowIndex];
     else if ([identifier isEqualToString: @"shortcut"])
-        return [[VLCStringUtility sharedInstance] OSXStringKeyToString:[_hotkeySettings objectAtIndex:rowIndex]];
+        return OSXStringKeyToString([_hotkeySettings objectAtIndex:rowIndex]);
     else {
         msg_Err(p_intf, "unknown TableColumn identifier (%s)!", [identifier UTF8String]);
         return NULL;
@@ -1429,7 +1429,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
         [_hotkeys_change_okButton setEnabled: NO];
         return NO;
     } else {
-        [_hotkeys_change_keysLabel setStringValue: [[VLCStringUtility sharedInstance] OSXStringKeyToString:theKey]];
+        [_hotkeys_change_keysLabel setStringValue: OSXStringKeyToString(theKey)];
 
         i_returnValue = [_hotkeySettings indexOfObject: theKey];
         i_returnValue2 = [_hotkeySettings indexOfObject: [theKey stringByReplacingOccurrencesOfString:@"-" withString:@"+"]];
diff --git a/modules/gui/macosx/VLCStringUtility.h b/modules/gui/macosx/VLCStringUtility.h
deleted file mode 100644
index 9efd7cf26c..0000000000
--- a/modules/gui/macosx/VLCStringUtility.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*****************************************************************************
- * VLCStringUtility.h: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2002-2014 VLC authors and VideoLAN
- *
- * Authors: Jon Lech Johansen <jon-vl at nanocrew.net>
- *          Christophe Massiot <massiot at via.ecp.fr>
- *          Derk-Jan Hartman <hartman at videolan dot org>
- *          Felix Paul Kühne <fkuehne at videolan dot org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#import <Cocoa/Cocoa.h>
-
-#import <vlc_common.h>
-#import <vlc_input.h>
-
-
-#define _NS(s) ((s) ? toNSStr(vlc_gettext(s)) : @"")
-
-/* Get an alternate version of the string.
- * This string is stored as '1:string' but when displayed it only displays
- * the translated string. the translation should be '1:translatedstring' though */
-#define _ANS(s) [((s) ? toNSStr(vlc_gettext(s)) : @"") substringFromIndex:2]
-
-extern NSString *const kVLCMediaAudioCD;
-extern NSString *const kVLCMediaDVD;
-extern NSString *const kVLCMediaVCD;
-extern NSString *const kVLCMediaSVCD;
-extern NSString *const kVLCMediaBD;
-extern NSString *const kVLCMediaVideoTSFolder;
-extern NSString *const kVLCMediaBDMVFolder;
-extern NSString *const kVLCMediaUnknown;
-
-NSString *toNSStr(const char *str);
-unsigned int CocoaKeyToVLC(unichar i_key);
-
-/**
- * Gets an image resource
- */
-NSImage *imageFromRes(NSString *name);
-
-/**
- * Fix certain settings strings before saving
- */
-bool fixIntfSettings(void);
-
- at interface VLCStringUtility : NSObject
-
-+ (VLCStringUtility *)sharedInstance;
-
-- (NSString *)OSXStringKeyToString:(NSString *)theString;
-- (NSString *)VLCKeyToString:(NSString *)theString;
-- (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
-
-- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath;
-- (NSString *)getBSDNodeFromMountPath:(NSString *)mountPath;
-
- at end
diff --git a/modules/gui/macosx/VLCStringUtility.m b/modules/gui/macosx/VLCStringUtility.m
deleted file mode 100644
index b0169266ff..0000000000
--- a/modules/gui/macosx/VLCStringUtility.m
+++ /dev/null
@@ -1,395 +0,0 @@
-/*****************************************************************************
- * VLCStringUtility.m: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2002-2018 VLC authors and VideoLAN
- *
- * Authors: Jon Lech Johansen <jon-vl at nanocrew.net>
- *          Christophe Massiot <massiot at via.ecp.fr>
- *          Derk-Jan Hartman <hartman at videolan dot org>
- *          Felix Paul Kühne <fkuehne at videolan dot org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#import "VLCStringUtility.h"
-
-#import "VLCMain.h"
-#import "CompatibilityFixes.h"
-
-#import <sys/param.h>
-#import <sys/mount.h>
-
-#import <IOKit/storage/IOMedia.h>
-#import <IOKit/storage/IOCDMedia.h>
-#import <IOKit/storage/IODVDMedia.h>
-#import <IOKit/storage/IOBDMedia.h>
-
-NSString *const kVLCMediaAudioCD = @"AudioCD";
-NSString *const kVLCMediaDVD = @"DVD";
-NSString *const kVLCMediaVCD = @"VCD";
-NSString *const kVLCMediaSVCD = @"SVCD";
-NSString *const kVLCMediaBD = @"Blu-ray";
-NSString *const kVLCMediaVideoTSFolder = @"VIDEO_TS";
-NSString *const kVLCMediaBDMVFolder = @"BDMV";
-NSString *const kVLCMediaUnknown = @"Unknown";
-
-#import <vlc_actions.h>
-#import <vlc_strings.h>
-
- at implementation VLCStringUtility
-
-
-+ (VLCStringUtility *)sharedInstance
-{
-    static VLCStringUtility *sharedInstance = nil;
-    static dispatch_once_t pred;
-
-    dispatch_once(&pred, ^{
-        sharedInstance = [VLCStringUtility new];
-    });
-
-    return sharedInstance;
-}
-
-#pragma mark -
-#pragma mark Key Shortcuts
-
-static struct
-{
-    unichar i_nskey;
-    unsigned int i_vlckey;
-} nskeys_to_vlckeys[] =
-{
-    { NSUpArrowFunctionKey, KEY_UP },
-    { NSDownArrowFunctionKey, KEY_DOWN },
-    { NSLeftArrowFunctionKey, KEY_LEFT },
-    { NSRightArrowFunctionKey, KEY_RIGHT },
-    { NSF1FunctionKey, KEY_F1 },
-    { NSF2FunctionKey, KEY_F2 },
-    { NSF3FunctionKey, KEY_F3 },
-    { NSF4FunctionKey, KEY_F4 },
-    { NSF5FunctionKey, KEY_F5 },
-    { NSF6FunctionKey, KEY_F6 },
-    { NSF7FunctionKey, KEY_F7 },
-    { NSF8FunctionKey, KEY_F8 },
-    { NSF9FunctionKey, KEY_F9 },
-    { NSF10FunctionKey, KEY_F10 },
-    { NSF11FunctionKey, KEY_F11 },
-    { NSF12FunctionKey, KEY_F12 },
-    { NSInsertFunctionKey, KEY_INSERT },
-    { NSHomeFunctionKey, KEY_HOME },
-    { NSEndFunctionKey, KEY_END },
-    { NSPageUpFunctionKey, KEY_PAGEUP },
-    { NSPageDownFunctionKey, KEY_PAGEDOWN },
-    { NSMenuFunctionKey, KEY_MENU },
-    { NSTabCharacter, KEY_TAB },
-    { NSCarriageReturnCharacter, KEY_ENTER },
-    { NSEnterCharacter, KEY_ENTER },
-    { NSBackspaceCharacter, KEY_BACKSPACE },
-    { NSDeleteCharacter, KEY_DELETE },
-    {0,0}
-};
-
-/*
- * Takes the first value of an cocoa key string, and converts it to VLCs int representation.
- */
-unsigned int CocoaKeyToVLC(unichar i_key)
-{
-    unsigned int i;
-
-    for (i = 0; nskeys_to_vlckeys[i].i_nskey != 0; i++) {
-        if (nskeys_to_vlckeys[i].i_nskey == i_key) {
-            return nskeys_to_vlckeys[i].i_vlckey;
-        }
-    }
-    return (unsigned int)i_key;
-}
-
-/* takes a good old const c string and converts it to NSString without UTF8 loss */
-
-NSString *toNSStr(const char *str) {
-    return str != NULL ? [NSString stringWithUTF8String:str] : @"";
-}
-
-/*
- * Converts VLC key string to a prettified version, for hotkey settings.
- * The returned string adapts similar how its done within the cocoa framework when setting this
- * key to menu items.
- */
-- (NSString *)OSXStringKeyToString:(NSString *)theString
-{
-    if (![theString isEqualToString:@""]) {
-        /* remove cruft */
-        if ([theString characterAtIndex:([theString length] - 1)] != 0x2b)
-            theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
-        else {
-            theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
-            theString = [NSString stringWithFormat:@"%@+", theString];
-        }
-        if ([theString characterAtIndex:([theString length] - 1)] != 0x2d)
-            theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
-        else {
-            theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
-            theString = [NSString stringWithFormat:@"%@-", theString];
-        }
-        /* modifiers */
-        theString = [theString stringByReplacingOccurrencesOfString:@"Command" withString: [NSString stringWithUTF8String:"\xE2\x8C\x98"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Alt" withString: [NSString stringWithUTF8String:"\xE2\x8C\xA5"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Shift" withString: [NSString stringWithUTF8String:"\xE2\x87\xA7"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Ctrl" withString: [NSString stringWithUTF8String:"\xE2\x8C\x83"]];
-        /* show non-character keys correctly */
-        theString = [theString stringByReplacingOccurrencesOfString:@"Right" withString:[NSString stringWithUTF8String:"\xE2\x86\x92"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Left" withString:[NSString stringWithUTF8String:"\xE2\x86\x90"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Page Up" withString:[NSString stringWithUTF8String:"\xE2\x87\x9E"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Page Down" withString:[NSString stringWithUTF8String:"\xE2\x87\x9F"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Up" withString:[NSString stringWithUTF8String:"\xE2\x86\x91"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Down" withString:[NSString stringWithUTF8String:"\xE2\x86\x93"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Enter" withString:[NSString stringWithUTF8String:"\xe2\x86\xb5"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Tab" withString:[NSString stringWithUTF8String:"\xe2\x87\xa5"]];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Delete" withString:[NSString stringWithUTF8String:"\xe2\x8c\xab"]];        /* capitalize plain characters to suit the menubar's look */
-        theString = [theString capitalizedString];
-    }
-    else
-        theString = [NSString stringWithString:_NS("Not Set")];
-    return theString;
-}
-
-/*
- * Converts VLC key string to cocoa modifiers which can be used as setKeyEquivalent for menu items
- */
-- (unsigned int)VLCModifiersToCocoa:(NSString *)theString
-{
-    unsigned int new = 0;
-
-    if ([theString rangeOfString:@"Command"].location != NSNotFound)
-        new |= NSCommandKeyMask;
-    if ([theString rangeOfString:@"Alt"].location != NSNotFound)
-        new |= NSAlternateKeyMask;
-    if ([theString rangeOfString:@"Shift"].location != NSNotFound)
-        new |= NSShiftKeyMask;
-    if ([theString rangeOfString:@"Ctrl"].location != NSNotFound)
-        new |= NSControlKeyMask;
-    return new;
-}
-
-/*
- * Converts VLC key to cocoa string which can be used as setKeyEquivalentModifierMask for menu items
- */
-- (NSString *)VLCKeyToString:(NSString *)theString
-{
-    if (![theString isEqualToString:@""]) {
-        if ([theString characterAtIndex:([theString length] - 1)] != 0x2b)
-            theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
-        else {
-            theString = [theString stringByReplacingOccurrencesOfString:@"+" withString:@""];
-            theString = [NSString stringWithFormat:@"%@+", theString];
-        }
-        if ([theString characterAtIndex:([theString length] - 1)] != 0x2d)
-            theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
-        else {
-            theString = [theString stringByReplacingOccurrencesOfString:@"-" withString:@""];
-            theString = [NSString stringWithFormat:@"%@-", theString];
-        }
-        theString = [theString stringByReplacingOccurrencesOfString:@"Command" withString:@""];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Alt" withString:@""];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Shift" withString:@""];
-        theString = [theString stringByReplacingOccurrencesOfString:@"Ctrl" withString:@""];
-    }
-
-#ifdef __clang__
-#pragma GCC diagnostic ignored "-Wformat"
-#endif
-    if ([theString length] > 1) {
-        if ([theString rangeOfString:@"Page Up"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSPageUpFunctionKey];
-        else if ([theString rangeOfString:@"Page Down"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSPageDownFunctionKey];
-        else if ([theString rangeOfString:@"Up"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSUpArrowFunctionKey];
-        else if ([theString rangeOfString:@"Down"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSDownArrowFunctionKey];
-        else if ([theString rangeOfString:@"Right"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSRightArrowFunctionKey];
-        else if ([theString rangeOfString:@"Left"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSLeftArrowFunctionKey];
-        else if ([theString rangeOfString:@"Enter"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSEnterCharacter]; // we treat NSCarriageReturnCharacter as aquivalent
-        else if ([theString rangeOfString:@"Insert"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSInsertFunctionKey];
-        else if ([theString rangeOfString:@"Home"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSHomeFunctionKey];
-        else if ([theString rangeOfString:@"End"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSEndFunctionKey];
-        else if ([theString rangeOfString:@"Menu"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSMenuFunctionKey];
-        else if ([theString rangeOfString:@"Tab"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSTabCharacter];
-        else if ([theString rangeOfString:@"Backspace"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSBackspaceCharacter];
-        else if ([theString rangeOfString:@"Delete"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSDeleteCharacter];
-        else if ([theString rangeOfString:@"F12"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF12FunctionKey];
-        else if ([theString rangeOfString:@"F11"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF11FunctionKey];
-        else if ([theString rangeOfString:@"F10"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF10FunctionKey];
-        else if ([theString rangeOfString:@"F9"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF9FunctionKey];
-        else if ([theString rangeOfString:@"F8"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF8FunctionKey];
-        else if ([theString rangeOfString:@"F7"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF7FunctionKey];
-        else if ([theString rangeOfString:@"F6"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF6FunctionKey];
-        else if ([theString rangeOfString:@"F5"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF5FunctionKey];
-        else if ([theString rangeOfString:@"F4"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF4FunctionKey];
-        else if ([theString rangeOfString:@"F3"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF3FunctionKey];
-        else if ([theString rangeOfString:@"F2"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF2FunctionKey];
-        else if ([theString rangeOfString:@"F1"].location != NSNotFound)
-            return [NSString stringWithFormat:@"%C", NSF1FunctionKey];
-        else if ([theString rangeOfString:@"Space"].location != NSNotFound)
-            return @" ";
-        /* note that we don't support esc here, since it is reserved for leaving fullscreen */
-    }
-#ifdef __clang__
-#pragma GCC diagnostic warning "-Wformat"
-#endif
-
-    return theString;
-}
-
-- (NSString *) getBSDNodeFromMountPath:(NSString *)mountPath
-{
-    struct statfs stf;
-    int ret = statfs([mountPath fileSystemRepresentation], &stf);
-    if (ret != 0) {
-        return @"";
-    }
-
-    return [NSString stringWithFormat:@"r%s", stf.f_mntfromname];
-}
-
-- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath
-{
-    struct statfs stf;
-    int ret = statfs([mountPath fileSystemRepresentation], &stf);
-    if (ret != 0) {
-        return @"";
-    }
-
-    CFMutableDictionaryRef matchingDict = IOBSDNameMatching(kIOMasterPortDefault, 0, stf.f_mntfromname);
-    io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict);
-    NSString *returnValue;
-
-    if (IO_OBJECT_NULL != service) {
-        if (IOObjectConformsTo(service, kIOCDMediaClass))
-            returnValue = kVLCMediaAudioCD;
-        else if (IOObjectConformsTo(service, kIODVDMediaClass))
-            returnValue = kVLCMediaDVD;
-        else if (IOObjectConformsTo(service, kIOBDMediaClass))
-            returnValue = kVLCMediaBD;
-        IOObjectRelease(service);
-
-        if (returnValue)
-            return returnValue;
-    }
-
-    out:
-    if ([mountPath rangeOfString:@"VIDEO_TS" options:NSCaseInsensitiveSearch | NSBackwardsSearch].location != NSNotFound)
-        returnValue = kVLCMediaVideoTSFolder;
-    else if ([mountPath rangeOfString:@"BDMV" options:NSCaseInsensitiveSearch | NSBackwardsSearch].location != NSNotFound)
-        returnValue = kVLCMediaBDMVFolder;
-    else {
-        // NSFileManager is not thread-safe, don't use defaultManager outside of the main thread
-        NSFileManager * fm = [[NSFileManager alloc] init];
-
-        NSArray *dirContents = [fm contentsOfDirectoryAtPath:mountPath error:nil];
-        for (int i = 0; i < [dirContents count]; i++) {
-            NSString *currentFile = [dirContents objectAtIndex:i];
-            NSString *fullPath = [mountPath stringByAppendingPathComponent:currentFile];
-
-            BOOL isDir;
-            if ([fm fileExistsAtPath:fullPath isDirectory:&isDir] && isDir)
-            {
-                if ([currentFile caseInsensitiveCompare:@"SVCD"] == NSOrderedSame) {
-                    returnValue = kVLCMediaSVCD;
-                    break;
-                }
-                if ([currentFile caseInsensitiveCompare:@"VCD"] == NSOrderedSame) {
-                    returnValue = kVLCMediaVCD;
-                    break;
-                }
-                if ([currentFile caseInsensitiveCompare:@"BDMV"] == NSOrderedSame) {
-                    returnValue = kVLCMediaBDMVFolder;
-                    break;
-                }
-                if ([currentFile caseInsensitiveCompare:@"VIDEO_TS"] == NSOrderedSame) {
-                    returnValue = kVLCMediaVideoTSFolder;
-                    break;
-                }
-            }
-        }
-
-        if (!returnValue)
-            returnValue = kVLCMediaVideoTSFolder;
-    }
-
-    return returnValue;
-}
-
- at end
-
-NSImage *imageFromRes(NSString *name)
-{
-    return [NSImage imageNamed:name];
-}
-
-bool fixIntfSettings(void)
-{
-    NSMutableString * o_workString;
-    NSRange returnedRange;
-    NSRange fullRange;
-    BOOL b_needsRestart = NO;
-
-    #define fixpref(pref) \
-    o_workString = [[NSMutableString alloc] initWithFormat:@"%s", config_GetPsz(pref)]; \
-    if ([o_workString length] > 0) \
-    { \
-        returnedRange = [o_workString rangeOfString:@"macosx" options: NSCaseInsensitiveSearch]; \
-        if (returnedRange.location != NSNotFound) \
-            { \
-            if ([o_workString isEqualToString:@"macosx"]) \
-                [o_workString setString:@""]; \
-            fullRange = NSMakeRange(0, [o_workString length]); \
-            [o_workString replaceOccurrencesOfString:@":macosx" withString:@"" options: NSCaseInsensitiveSearch range: fullRange]; \
-            fullRange = NSMakeRange(0, [o_workString length]); \
-            [o_workString replaceOccurrencesOfString:@"macosx:" withString:@"" options: NSCaseInsensitiveSearch range: fullRange]; \
-            \
-            config_PutPsz(pref, [o_workString UTF8String]); \
-            b_needsRestart = YES; \
-        } \
-    }
-
-    fixpref("control");
-    fixpref("extraintf");
-#undef fixpref
-
-    return b_needsRestart;
-}
diff --git a/modules/gui/macosx/VLCTimeSelectionPanelController.m b/modules/gui/macosx/VLCTimeSelectionPanelController.m
index 1589325320..59fd369428 100644
--- a/modules/gui/macosx/VLCTimeSelectionPanelController.m
+++ b/modules/gui/macosx/VLCTimeSelectionPanelController.m
@@ -20,9 +20,8 @@
  *****************************************************************************/
 
 #import "VLCTimeSelectionPanelController.h"
-
+#import "NSString+Helpers.h"
 #import "misc.h"
-#import "VLCStringUtility.h"
 
 @interface VLCTimeSelectionPanelController()
 {
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index d6e4f253a8..8e5c916f38 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -29,7 +29,7 @@
 #import "VLCMainMenu.h"
 #import "VLCControlsBarCommon.h"
 #import "VLCCoreInteraction.h"
-#import "VLCStringUtility.h"
+#import "NSString+Helpers.h"
 #import <vlc_actions.h>
 
 /*****************************************************************************
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1d01b5b8fd..739c5957d9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -541,8 +541,6 @@ modules/gui/macosx/VLCSliderCell.h
 modules/gui/macosx/VLCSliderCell.m
 modules/gui/macosx/VLCStatusBarIcon.h
 modules/gui/macosx/VLCStatusBarIcon.m
-modules/gui/macosx/VLCStringUtility.h
-modules/gui/macosx/VLCStringUtility.m
 modules/gui/macosx/VLCTextfieldPanelController.h
 modules/gui/macosx/VLCTextfieldPanelController.m
 modules/gui/macosx/VLCTimeField.h



More information about the vlc-commits mailing list