Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions MacDown.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -971,8 +971,9 @@
1FA6DE191941CC9E000409FB /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
CLASSPREFIX = MP;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 2600;
ORGANIZATIONNAME = "Tzu-ping Chung ";
TargetAttributes = {
1FA6DE441941CC9E000409FB = {
Expand Down Expand Up @@ -1191,12 +1192,10 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-MacDown/Pods-MacDown-frameworks.sh",
"${PODS_ROOT}/Sparkle/Sparkle.framework",
"${PODS_ROOT}/Sparkle/Sparkle.framework.dSYM",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sparkle.framework",
"${DWARF_DSYM_FOLDER_PATH}/Sparkle.framework.dSYM",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -1667,22 +1666,27 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
Expand All @@ -1702,6 +1706,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.8;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
};
name = Debug;
};
Expand All @@ -1718,23 +1723,28 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
Expand All @@ -1746,6 +1756,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
};
name = Release;
};
Expand All @@ -1754,12 +1765,13 @@
baseConfigurationReference = 1A198D1BA59D710201DD3BC8 /* Pods-MacDown.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "MacDown/Code/MacDown-Prefix.pch";
INFOPLIST_FILE = "MacDown/MacDown-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.uranusjr.${PRODUCT_NAME:rfc1034identifier:lower}-debug";
PRODUCT_NAME = MacDown;
SDKROOT = macosx;
Expand All @@ -1772,12 +1784,13 @@
baseConfigurationReference = 39EFCAE04F60154F0C8C5469 /* Pods-MacDown.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "MacDown/Code/MacDown-Prefix.pch";
INFOPLIST_FILE = "MacDown/MacDown-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.uranusjr.${PRODUCT_NAME:rfc1034identifier:lower}";
PRODUCT_NAME = MacDown;
SDKROOT = macosx;
Expand All @@ -1792,6 +1805,7 @@
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MacDown.app/Contents/MacOS/MacDown";
CLANG_ENABLE_MODULES = NO;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
Expand All @@ -1807,7 +1821,7 @@
"$(inherited)",
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/MacDown-ggdtxvuybojeqbhjydkhilziizrv/Build/Products/Debug",
);
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.uranusjr.${PRODUCT_NAME:rfc1034identifier:lower}";
PRODUCT_NAME = MacDownTests;
TEST_HOST = "$(BUNDLE_LOADER)";
Expand All @@ -1822,6 +1836,7 @@
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MacDown.app/Contents/MacOS/MacDown";
CLANG_ENABLE_MODULES = NO;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
Expand All @@ -1833,7 +1848,7 @@
"$(inherited)",
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/MacDown-ggdtxvuybojeqbhjydkhilziizrv/Build/Products/Debug",
);
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.uranusjr.${PRODUCT_NAME:rfc1034identifier:lower}";
PRODUCT_NAME = MacDownTests;
TEST_HOST = "$(BUNDLE_LOADER)";
Expand All @@ -1845,12 +1860,14 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 4DBAA63927A60EB2150642B3 /* Pods-macdown-cmd.debug.xcconfig */;
buildSettings = {
DEAD_CODE_STRIPPING = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_NAME = macdown;
SKIP_INSTALL = YES;
};
Expand All @@ -1860,8 +1877,10 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7A8EA75FA95818275755F0B6 /* Pods-macdown-cmd.release.xcconfig */;
buildSettings = {
DEAD_CODE_STRIPPING = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_NAME = macdown;
SKIP_INSTALL = YES;
};
Expand Down
24 changes: 10 additions & 14 deletions MacDown.xcodeproj/xcshareddata/xcschemes/MacDown.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "2600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1FA6DE201941CC9E000409FB"
BuildableName = "MacDown.app"
BlueprintName = "MacDown"
ReferencedContainer = "container:MacDown.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1FA6DE201941CC9E000409FB"
BuildableName = "MacDown.app"
BlueprintName = "MacDown"
ReferencedContainer = "container:MacDown.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -71,8 +69,6 @@
ReferencedContainer = "container:MacDown.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<string>Latest</string>
</dict>
</plist>
14 changes: 13 additions & 1 deletion MacDown/Code/Document/MPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,14 @@ - (BOOL)writeToURL:(NSURL *)url ofType:(NSString *)typeName
self.editor.selectedRange = selection;
}
}
return [super writeToURL:url ofType:typeName error:outError];
BOOL ok = [super writeToURL:url ofType:typeName error:outError];
if (ok)
{
NSDocumentController *controller =
[NSDocumentController sharedDocumentController];
[controller mp_noteNewRecentDocumentURL:url];
}
return ok;
}

- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
Expand All @@ -552,6 +559,11 @@ - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName

self.loadedString = content;
[self reloadFromLoadedString];

// Ensure the file is registered for the system "Open Recent" menu.
NSDocumentController *controller =
[NSDocumentController sharedDocumentController];
[controller mp_noteNewRecentDocumentURL:self.fileURL];
return YES;
}

Expand Down
5 changes: 5 additions & 0 deletions MacDown/Code/Extension/NSDocumentController+Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
- (__kindof NSDocument *)createNewEmptyDocumentForURL:(NSURL *)url
display:(BOOL)display error:(NSError * __autoreleasing *)error;

// Explicitly note a recently used document URL for the system "Open Recent"
// menu. We filter out temporary files to avoid polluting the list with app
// internals (help/treat files, etc.).
- (void)mp_noteNewRecentDocumentURL:(NSURL *)url;

@end
31 changes: 31 additions & 0 deletions MacDown/Code/Extension/NSDocumentController+Document.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@

@implementation NSDocumentController (Document)

- (void)mp_noteNewRecentDocumentURL:(NSURL *)url
{
if (!url || !url.isFileURL)
return;

NSString *path = url.path;
if (!path.length)
return;

// Skip temp files (help, treats, other internal/generated docs).
NSString *tmp = NSTemporaryDirectory();
if (tmp.length)
{
NSString *tmpResolved =
[[tmp stringByStandardizingPath] stringByResolvingSymlinksInPath];
if (tmpResolved.length && ![tmpResolved hasSuffix:@"/"])
tmpResolved = [tmpResolved stringByAppendingString:@"/"];

NSString *pathResolved =
[[path stringByStandardizingPath] stringByResolvingSymlinksInPath];
if (tmpResolved.length && [pathResolved hasPrefix:tmpResolved])
return;
}

// Recent-documents updates are UI-adjacent; keep it on the main queue.
dispatch_async(dispatch_get_main_queue(), ^{
[self noteNewRecentDocumentURL:url];
});
}

- (__kindof NSDocument *)createNewEmptyDocumentForURL:(NSURL *)url
display:(BOOL)display error:(NSError * __autoreleasing *)error
{
Expand All @@ -24,6 +54,7 @@ - (__kindof NSDocument *)createNewEmptyDocumentForURL:(NSURL *)url

doc.draft = YES;
doc.fileURL = url;
[self mp_noteNewRecentDocumentURL:url];
return doc;
}

Expand Down
Empty file.
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: e9356b9a2ceafda7889ba385de6e9f2d8b06cba0

COCOAPODS: 1.8.4
COCOAPODS: 1.16.2