Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ololx committed Aug 7, 2021
2 parents 1c02a24 + 937cd3e commit 21066e2
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 35 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

- Refactor application.

## [0.6.0] - 2021-08-02

### Changed

- Changed the activity property of some menu items according to the rule:
- if no object was copied, then the menu items "Paste link to here" an "Move it here and replace with a link" are not active;
- if at least one object was not copied, then the menu items "Paste link to here" an "Move it here and replace with a link" are inactive;

### Added

- Added cleaning clipboard after inserting links;

## [0.5.0] - 2021-08-02

### Added
Expand Down
51 changes: 25 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.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-August_02,_2021-informational?style=flat-square)](BADGES_GUIDE.md#release-date) [![last commit](https://img.shields.io/badge/last_commit-August_02,_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.6.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-August_07,_2021-informational?style=flat-square)](BADGES_GUIDE.md#release-date) [![last commit](https://img.shields.io/badge/last_commit-August_07,_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)

Expand Down Expand Up @@ -140,33 +140,32 @@ https://github.com/ololx/quick-symlink.git
### Using

This tool allows to:
* Create symlinks in the current directory
* Create symlinks in another directory
* Replace objects with symbolic links

#### Creating symlinks in the current directory

1. Select folders or files for which a symbolic link is needed.
2. Call the contextual menu by the right-clicking on selected.
3. Select menu item `Quick Symlink --> Create symlink for`.

#### Creating symlinks in another directory

1. Select folders or files for which a symbolic link is needed.
2. Call the contextual menu by the right-clicking on selected.
3. Select menu item `Quick Symlink --> Copy path from here`.
4. Go to a destination folder.
5. Call the contextual menu by right-clicking on the filder.
6. Select menu item `Quick Symlink --> Paste to here`.
<details close>
<summary>Create symlinks in the current directory</summary>
1. Select folders or files for which a symbolic link is needed.<br/>
2. Call the contextual menu by the right-clicking on selected.<br/>
3. Select menu item `Quick Symlink --> Create symlink for`.<br/>
</details>

#### Replacing objects with symbolic links
<details close>
<summary>Create symlinks in another directory</summary>
1. Select folders or files for which a symbolic link is needed.<br/>
2. Call the contextual menu by the right-clicking on selected.<br/>
3. Select menu item `Quick Symlink --> Copy path from here`.<br/>
4. Go to a destination folder.<br/>
5. Call the contextual menu by right-clicking on the filder.<br/>
6. Select menu item `Quick Symlink --> Paste to here`.<br/>
</details>

1. Select folders or files for which a symbolic link is needed.
2. Call the contextual menu by the right-clicking on selected.
3. Select menu item `Quick Symlink --> Copy to clipboard`.
4. Go to a destination folder.
5. Call the contextual menu by right-clicking on the filder.
6. Select menu item `Quick Symlink --> Move it here and replace with a link`.
<details close>
<summary>Replace objects with symbolic links</summary>
1. Select folders or files for which a symbolic link is needed.<br/>
2. Call the contextual menu by the right-clicking on selected.<br/>
3. Select menu item `Quick Symlink --> Copy to clipboard`.<br/>
4. Go to a destination folder.<br/>
5. Call the contextual menu by right-clicking on the filder.<br/>
6. Select menu item `Quick Symlink --> Move it here and replace with a link`.<br/>
</details>

## 🛠 Built With

Expand Down
2 changes: 1 addition & 1 deletion commons/CopyPathAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class CopyPathAction: QuickSymlinkAction {
paths.removeLast();

//Copy path list to clipboard
let pasteboard = NSPasteboard.general;
let pasteboard = NSPasteboard.init(name: NSPasteboard.Name.init(rawValue: "qs"));
pasteboard.declareTypes([NSPasteboard.PasteboardType.string], owner: nil);
pasteboard.setString(paths, forType: NSPasteboard.PasteboardType.string);
}
Expand Down
4 changes: 3 additions & 1 deletion commons/PasteLinkAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ public class PasteLinkAction: QuickSymlinkAction {
return;
}

let pathsFromClipboard = NSPasteboard.general.string(forType: NSPasteboard.PasteboardType.string) ?? "";
let pasteboard = NSPasteboard.init(name: NSPasteboard.Name.init(rawValue: "qs"));
let pathsFromClipboard = pasteboard.string(forType: NSPasteboard.PasteboardType.string) ?? "";
if pathsFromClipboard.isEmpty {
return;
}
pasteboard.clearContents();

let paths = pathsFromClipboard.components(separatedBy: ";");
for path in paths {
Expand Down
4 changes: 3 additions & 1 deletion commons/ReplaceWithLinkAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ public class ReplaceWithLinkAction: QuickSymlinkAction {
return;
}

let pathsFromClipboard = NSPasteboard.general.string(forType: NSPasteboard.PasteboardType.string) ?? "";
let pasteboard = NSPasteboard.init(name: NSPasteboard.Name.init(rawValue: "qs"));
let pathsFromClipboard = pasteboard.string(forType: NSPasteboard.PasteboardType.string) ?? "";
if pathsFromClipboard.isEmpty {
return;
}
pasteboard.clearContents();

let paths = pathsFromClipboard.components(separatedBy: ";");
for path in paths {
Expand Down
20 changes: 14 additions & 6 deletions quick-symlink-extension/FinderSync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class FinderSync: FIFinderSync {
finderSync.directoryURLs.insert(volumeURL);
}
}

//FIFinderSyncController.default().directoryURLs = [self.myFolderURL];
}

// MARK: - Primary Finder Sync protocol methods
Expand Down Expand Up @@ -80,21 +78,31 @@ class FinderSync: FIFinderSync {
action: #selector(createSymlink(_:)),
keyEquivalent: ""
);

quickSymlinkMenu.addItem(
withTitle: NSLocalizedString("COPY_PATH_ACTION_NAME", comment: ""),
action: #selector(copyPathToClipboard(_:)),
keyEquivalent: ""
);
quickSymlinkMenu.addItem(
withTitle: NSLocalizedString("PASTE_LINK_ACTION_NAME", comment: ""),

let pastleSymlinkFromClipboardMenuItem = NSMenuItem.init(
title: NSLocalizedString("PASTE_LINK_ACTION_NAME", comment: ""),
action: #selector(pastleSymlinkFromClipboard(_:)),
keyEquivalent: ""
);
quickSymlinkMenu.addItem(
withTitle: NSLocalizedString("REPLACE_WITH_LINK_ACTION_NAME", comment: ""),
quickSymlinkMenu.addItem(pastleSymlinkFromClipboardMenuItem);

let replaceFileWithSymlinkFromClipboardMenuItem = NSMenuItem.init(
title: NSLocalizedString("REPLACE_WITH_LINK_ACTION_NAME", comment: ""),
action: #selector(replaceFileWithSymlinkFromClipboard(_:)),
keyEquivalent: ""
);
quickSymlinkMenu.addItem(replaceFileWithSymlinkFromClipboardMenuItem);

if (NSPasteboard.init(name: NSPasteboard.Name.init(rawValue: "qs")).string(forType: NSPasteboard.PasteboardType.string) ?? "").isEmpty {
pastleSymlinkFromClipboardMenuItem.isEnabled = false;
replaceFileWithSymlinkFromClipboardMenuItem.isEnabled = false;
}

if menuKind.rawValue == 3 {
return quickSymlinkMenu;
Expand Down

0 comments on commit 21066e2

Please sign in to comment.