macOS: Add open files to system recent files #107174
|
@ -72,7 +72,7 @@ class GHOST_ISystemPaths {
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
virtual void addToSystemRecentFiles(const char *filename) const = 0;
|
virtual void addToSystemRecentFiles(const char *filepath) const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The one and only system paths. */
|
/** The one and only system paths. */
|
||||||
|
|
|
@ -47,5 +47,5 @@ class GHOST_SystemPaths : public GHOST_ISystemPaths {
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
virtual void addToSystemRecentFiles(const char *filename) const = 0;
|
virtual void addToSystemRecentFiles(const char *filepath) const = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,5 +54,5 @@ class GHOST_SystemPathsCocoa : public GHOST_SystemPaths {
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
void addToSystemRecentFiles(const char *filename) const;
|
void addToSystemRecentFiles(const char *filepath) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
* Copyright 2010 Blender Foundation */
|
* Copyright 2010 Blender Foundation */
|
||||||
|
|
||||||
|
#import <AppKit/NSDocumentController.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#include "GHOST_Debug.hh"
|
#include "GHOST_Debug.hh"
|
||||||
|
@ -112,7 +113,10 @@ const char *GHOST_SystemPathsCocoa::getBinaryDir() const
|
||||||
return tempPath;
|
return tempPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char *filename) const
|
void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char *filepath) const
|
||||||
{
|
{
|
||||||
/* TODO: implement for macOS */
|
@autoreleasepool {
|
||||||
|
NSURL *const file_url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:filepath]];
|
||||||
|
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:file_url];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,5 +52,5 @@ class GHOST_SystemPathsUnix : public GHOST_SystemPaths {
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
void addToSystemRecentFiles(const char *filename) const;
|
void addToSystemRecentFiles(const char *filepath) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -117,10 +117,10 @@ const char *GHOST_SystemPathsWin32::getBinaryDir() const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char *filename) const
|
void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char *filepath) const
|
||||||
{
|
{
|
||||||
/* SHARD_PATH resolves to SHARD_PATHA for non-UNICODE build */
|
/* SHARD_PATH resolves to SHARD_PATHA for non-UNICODE build */
|
||||||
UTF16_ENCODE(filename);
|
UTF16_ENCODE(filepath);
|
||||||
SHAddToRecentDocs(SHARD_PATHW, filename_16);
|
SHAddToRecentDocs(SHARD_PATHW, filepath_16);
|
||||||
UTF16_UN_ENCODE(filename);
|
UTF16_UN_ENCODE(filepath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,5 +61,5 @@ class GHOST_SystemPathsWin32 : public GHOST_SystemPaths {
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
void addToSystemRecentFiles(const char *filename) const;
|
void addToSystemRecentFiles(const char *filepath) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1584,7 +1584,7 @@ static void wm_history_file_update(void)
|
||||||
/* Write current file to #BLENDER_HISTORY_FILE. */
|
/* Write current file to #BLENDER_HISTORY_FILE. */
|
||||||
wm_history_file_write();
|
wm_history_file_write();
|
||||||
|
|
||||||
/* also update most recent files on System */
|
/* Also update most recent files on system. */
|
||||||
GHOST_addToSystemRecentFiles(blendfile_path);
|
GHOST_addToSystemRecentFiles(blendfile_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue