]> git.lyx.org Git - lyx.git/blobdiff - src/support/os_unix.cpp
Now that exceptions are allowed, handle gracefully the case where a Buffer temp direc...
[lyx.git] / src / support / os_unix.cpp
index 0378e369a3f651ae298ca0163e8e62b412ddf52b..50701eaeb13b0c17539c2fc64f2bd50348949c24 100644 (file)
 #include <config.h>
 
 #include "support/os.h"
+#include "support/docstring.h"
+#include "support/FileName.h"
 
 #ifdef __APPLE__
-#include "debug.h"
 #include <Carbon/Carbon.h>
-#include <ApplicationServices/ApplicationServices.h>
-using std::endl;
 #endif
 
-using std::string;
-
+using namespace std;
 
 namespace lyx {
 namespace support {
@@ -88,12 +86,6 @@ string latex_path(string const & p)
 }
 
 
-bool is_absolute_path(string const & p)
-{
-       return !p.empty() && p[0] == '/';
-}
-
-
 char const * popen_read_mode()
 {
        return "r";
@@ -135,7 +127,7 @@ bool canAutoOpenFile(string const & ext, auto_open_mode const mode)
        (void)mode;
        LSRolesMask role = kLSRolesAll;
        FSRef outAppRef;
-       OSStatus status = 
+       OSStatus status =
                LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator,
                                        cfs_ext, role, &outAppRef, NULL);
        CFRelease(cfs_ext);
@@ -158,11 +150,11 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode)
 #ifdef __APPLE__
 // Reference: http://developer.apple.com/documentation/Carbon/Reference/LaunchServicesReference/
        FSRef fileref;
-       OSStatus status = 
+       OSStatus status =
                FSPathMakeRef((UInt8 *) filename.c_str(), &fileref, NULL);
        if (status != 0)
                return false;
-        
+
        // this is what we would like to do but it seems that the
        // viewer for PDF is often quicktime...
        //LSRolesMask role = (mode == VIEW) ? kLSRolesViewer :  kLSRolesEditor;
@@ -183,7 +175,7 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode)
        inLaunchSpec.asyncRefCon = NULL;
        status = LSOpenFromRefSpec(&inLaunchSpec, NULL);
 
-       return status != kLSApplicationNotFoundErr;     
+       return status != kLSApplicationNotFoundErr;
 #else
        // silence compiler warnings
        (void)filename;
@@ -195,42 +187,6 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode)
 #endif
 }
 
-
-void addFontResources()
-{
-#ifdef __APPLE__
-       CFBundleRef  myAppBundle = CFBundleGetMainBundle();
-       CFURLRef  myAppResourcesURL, FontsURL;
-       FSRef  fontDirRef;
-       FSSpec  fontDirSpec;
-       CFStringRef  filePath = CFStringCreateWithBytes(kCFAllocatorDefault,
-                                       (UInt8 *) "fonts", strlen("fonts"),
-                                       kCFStringEncodingISOLatin1, false);
-
-       myAppResourcesURL = CFBundleCopyResourcesDirectoryURL(myAppBundle);
-       FontsURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault,
-                       myAppResourcesURL, filePath, true);
-       if (lyxerr.debugging(Debug::FONT)) {
-               UInt8  buf[255];
-               if (CFURLGetFileSystemRepresentation(FontsURL, true, buf, 255))
-                       lyxerr << "Adding Fonts directory: " << buf << endl;
-       }
-       CFURLGetFSRef (FontsURL, &fontDirRef);
-       OSStatus err = FSGetCatalogInfo (&fontDirRef, kFSCatInfoNone,
-                                        NULL, NULL, &fontDirSpec, NULL);
-       if (err)
-               lyxerr << "FSGetCatalogInfo err = " << err << endl;
-       err = FMActivateFonts (&fontDirSpec, NULL, NULL,
-                              kFMLocalActivationContext);
-       if (err)
-               lyxerr << "FMActivateFonts err = " << err << endl;
-#endif
-}
-
-
-void restoreFontResources()
-{}
-
 } // namespace os
 } // namespace support
 } // namespace lyx