From 6ea0d71f17dcb77c91d123294e0fd94948681116 Mon Sep 17 00:00:00 2001 From: "Alexander A. Kropotin" Date: Sat, 18 Sep 2021 08:57:07 +0500 Subject: [PATCH] feature(*) add the new settings for relative or absilute path usage --- CHANGELOG.md | 7 +++++++ README.md | 6 +++++- commons/defaults/QuickSymlinkDefaults.swift | 4 ++-- quick-symlink.xcodeproj/project.pbxproj | 15 +++++++++++-- quick-symlink/Base.lproj/Main.storyboard | 16 ++++++++++++++ quick-symlink/ViewController.swift | 21 ++++++++++++++++--- quick-symlink/quick_symlink.entitlements | 6 ++++-- .../soft-link-actions-extension.entitlements | 4 ++++ 8 files changed, 69 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a2cb2d..3f529aa 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Refactor application. +## [0.10.0] - 2021-09-18 + +### Added + +- Add the checkbox button on the application view to switch on/off the relative path use to create a symbolic link. +- Implement the strategy for create new symlink with relative or absolute path. + ## [0.9.0] - 2021-09-17 ### Changed diff --git a/README.md b/README.md index ea1b112..4b4735e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ The Quick Symlink is a `Finder extension` which provides a `contextual menu item` for the symbolic links creation on macOS. -[![status](https://img.shields.io/badge/status-active-active?style=flat-square)](BADGES_GUIDE.md#status) [![version](https://img.shields.io/badge/version-0.8.1-informational?style=flat-square)](BADGES_GUIDE.md#version) [![oss lifecycle](https://img.shields.io/badge/oss_lifecycle-active-important?style=flat-square)](BADGES_GUIDE.md#oss-lifecycle) [![maintenance](https://img.shields.io/badge/maintenance-yes-informational?style=flat-square)](BADGES_GUIDE.md#maintenance) [![last release](https://img.shields.io/badge/last_release-September_13,_2021-informational?style=flat-square)](BADGES_GUIDE.md#release-date) [![last commit](https://img.shields.io/badge/last_commit-September_13,_2021-informational?style=flat-square)](BADGES_GUIDE.md#commit-date) +[![status](https://img.shields.io/badge/status-active-active?style=flat-square)](BADGES_GUIDE.md#status) [![version](https://img.shields.io/badge/version-0.10.0-informational?style=flat-square)](BADGES_GUIDE.md#version) [![oss lifecycle](https://img.shields.io/badge/oss_lifecycle-active-important?style=flat-square)](BADGES_GUIDE.md#oss-lifecycle) [![maintenance](https://img.shields.io/badge/maintenance-yes-informational?style=flat-square)](BADGES_GUIDE.md#maintenance) [![last release](https://img.shields.io/badge/last_release-September_18,_2021-informational?style=flat-square)](BADGES_GUIDE.md#release-date) [![last commit](https://img.shields.io/badge/last_commit-September_18,_2021-informational?style=flat-square)](BADGES_GUIDE.md#commit-date) [![license](https://img.shields.io/badge/license-MIT-informational?style=flat-square)](LICENSE) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](CODE_OF_CONDUCT.md) @@ -129,6 +129,10 @@ pluginkit -r quick-symlink.app/Contents/PlugIns/quick-symlink-extension.appex/ pluginkit -r quick-symlink.app/Contents/PlugIns/hard-link-action-extension.appex/ ``` +5. [OPTIONAL] Check/Uncheck the checkbox on the Application window "Use relative path for symlink" to use the relative path instead absolute path for the creating symlinks. **By default it's enabled** + + + ### Downloading For the downloading executable file or sources to a local machine, just use the follows link and choose a required release: diff --git a/commons/defaults/QuickSymlinkDefaults.swift b/commons/defaults/QuickSymlinkDefaults.swift index 77e09a9..adf44e7 100644 --- a/commons/defaults/QuickSymlinkDefaults.swift +++ b/commons/defaults/QuickSymlinkDefaults.swift @@ -16,7 +16,7 @@ public struct QuickSymlinkDefaults { public extension QuickSymlinkDefaults { func get() -> T { - guard let valueUntyped = UserDefaults.init(suiteName: "org.ololx.quick-symlink")?.object(forKey: self.key) else { + guard let valueUntyped = UserDefaults.init(suiteName: "org.ololx.QuickSymlink")?.object(forKey: self.key) else { return self.defaultValue; } @@ -28,7 +28,7 @@ public extension QuickSymlinkDefaults { } func set(_ value: T) { - UserDefaults.init(suiteName: "org.ololx.quick-symlink")?.set(value, forKey: self.key); + UserDefaults.init(suiteName: "org.ololx.QuickSymlink")?.set(value, forKey: self.key); } } diff --git a/quick-symlink.xcodeproj/project.pbxproj b/quick-symlink.xcodeproj/project.pbxproj index 4548e17..8970b85 100644 --- a/quick-symlink.xcodeproj/project.pbxproj +++ b/quick-symlink.xcodeproj/project.pbxproj @@ -33,12 +33,12 @@ A345C9C226A0B30F004FBF0F /* CopyPathAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A345C9C126A0B30F004FBF0F /* CopyPathAction.swift */; }; A345C9C526A0B49C004FBF0F /* PasteLinkAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A345C9C426A0B49C004FBF0F /* PasteLinkAction.swift */; }; A345C9C826A0B552004FBF0F /* ReplaceWithLinkAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A345C9C726A0B552004FBF0F /* ReplaceWithLinkAction.swift */; }; + A35AF46726F51A0B009546C3 /* QuickSymlinkDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DC975B26F4A3B800B506D4 /* QuickSymlinkDefaults.swift */; }; A36F9B0626DFAC27009E95CE /* FileLinkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A36F9B0526DFAC27009E95CE /* FileLinkManager.swift */; }; A36F9B0726DFB127009E95CE /* FileLinkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A36F9B0526DFAC27009E95CE /* FileLinkManager.swift */; }; A3DC975226F4662F00B506D4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A3DC975626F4662F00B506D4 /* Localizable.strings */; }; A3DC975326F4662F00B506D4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A3DC975626F4662F00B506D4 /* Localizable.strings */; }; A3DC975426F4662F00B506D4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A3DC975626F4662F00B506D4 /* Localizable.strings */; }; - A3DC975C26F4A3B800B506D4 /* QuickSymlinkDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DC975B26F4A3B800B506D4 /* QuickSymlinkDefaults.swift */; }; A3DC975D26F4A3B800B506D4 /* QuickSymlinkDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DC975B26F4A3B800B506D4 /* QuickSymlinkDefaults.swift */; }; A3DC975E26F4A3B800B506D4 /* QuickSymlinkDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DC975B26F4A3B800B506D4 /* QuickSymlinkDefaults.swift */; }; A3E4D35526E0FD2900C9F175 /* FinderSync.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3E4D35426E0FD2900C9F175 /* FinderSync.swift */; }; @@ -372,11 +372,22 @@ A30B9AA6265CA63300ACAA63 = { CreatedOnToolsVersion = 9.2; ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.ApplicationGroups.Mac = { + enabled = 1; + }; + com.apple.Sandbox = { + enabled = 1; + }; + }; }; A30B9ABD265CA68900ACAA63 = { CreatedOnToolsVersion = 9.2; ProvisioningStyle = Automatic; SystemCapabilities = { + com.apple.ApplicationGroups.Mac = { + enabled = 1; + }; com.apple.Sandbox = { enabled = 1; }; @@ -464,7 +475,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - A3DC975C26F4A3B800B506D4 /* QuickSymlinkDefaults.swift in Sources */, A307B41A26D22116002EEF58 /* ResourcePath.swift in Sources */, A345C9C826A0B552004FBF0F /* ReplaceWithLinkAction.swift in Sources */, A316477726B7B403001DD969 /* CreateLinkAction.swift in Sources */, @@ -472,6 +482,7 @@ A30B9AAD265CA63300ACAA63 /* ViewController.swift in Sources */, A345C9C226A0B30F004FBF0F /* CopyPathAction.swift in Sources */, A345C9BF26A0B200004FBF0F /* QuickSymlinkAction.swift in Sources */, + A35AF46726F51A0B009546C3 /* QuickSymlinkDefaults.swift in Sources */, A30B9AAB265CA63300ACAA63 /* AppDelegate.swift in Sources */, A345C9C526A0B49C004FBF0F /* PasteLinkAction.swift in Sources */, A36F9B0626DFAC27009E95CE /* FileLinkManager.swift in Sources */, diff --git a/quick-symlink/Base.lproj/Main.storyboard b/quick-symlink/Base.lproj/Main.storyboard index 304bddb..a3736dd 100644 --- a/quick-symlink/Base.lproj/Main.storyboard +++ b/quick-symlink/Base.lproj/Main.storyboard @@ -709,7 +709,23 @@ + + + + + + diff --git a/quick-symlink/ViewController.swift b/quick-symlink/ViewController.swift index d936ed6..2f28355 100644 --- a/quick-symlink/ViewController.swift +++ b/quick-symlink/ViewController.swift @@ -9,11 +9,15 @@ import Cocoa class ViewController: NSViewController { + + @IBOutlet weak var useRelativePath: NSButton! + + var quickSymlinkDefaults: QuickSymlinkDefaults! = QuickSymlinkDefaults(key: "relative-path-strategy", defaultValue: true); override func viewDidLoad() { super.viewDidLoad() - - // Do any additional setup after loading the view. + + self.useRelativePath.state = NSControl.StateValue(rawValue: quickSymlinkDefaults.get() ? 1 : 0); } override var representedObject: Any? { @@ -22,6 +26,17 @@ class ViewController: NSViewController { } } - + + @IBAction func onChange(_ sender: NSButton) { + switch sender.state { + case .on: + quickSymlinkDefaults.set(true); + break; + case .off: + quickSymlinkDefaults.set(false); + break; + default: break; + } + } } diff --git a/quick-symlink/quick_symlink.entitlements b/quick-symlink/quick_symlink.entitlements index 19afff1..3c582f4 100644 --- a/quick-symlink/quick_symlink.entitlements +++ b/quick-symlink/quick_symlink.entitlements @@ -4,7 +4,9 @@ com.apple.security.app-sandbox - com.apple.security.files.user-selected.read-write - + com.apple.security.application-groups + + org.ololx.QuickSymlink + diff --git a/soft-link-actions-extension/soft-link-actions-extension.entitlements b/soft-link-actions-extension/soft-link-actions-extension.entitlements index 2c271ab..3136433 100644 --- a/soft-link-actions-extension/soft-link-actions-extension.entitlements +++ b/soft-link-actions-extension/soft-link-actions-extension.entitlements @@ -4,6 +4,10 @@ com.apple.security.app-sandbox + com.apple.security.application-groups + + org.ololx.QuickSymlink + com.apple.security.folders.user-selected.read-write com.apple.security.temporary-exception.files.absolute-path.read-write