How are we supposed to cut & paste files using NSPasteboard? Currently I implemented copy and paste by writing and reading file URLs. The problem with cut is, that after I wrote the URL to the pasteboard, I have to remove the file. And when I try to paste the file it doesn't exist anymore and I can't copy it. Should I write something else onto the pasteboard? I also thought about copying the file to a temporary hidden location, but that seems to be a bit inefficient. Is there any other solution?
Cut & paste of files with NSPasteboard
1.5k Views Asked by DrummerB At
1
There are 1 best solutions below
Related Questions in OBJECTIVE-C
- How do I customize NSOutlineView to have border color?
- UIWebView Screen Fitting Issue
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Image and Text locations in UIButton
- setting OpenGL version in objective-C
- Setup code for xibs in iOS. -awakFromNb:
- realm db, get parent link of object
- CFBundleDocumentType is not working in myproject-Info.plist file
- UIPopoverPresentationController not rendering properly
- Using Storyboard Reference
- Pass Data between two view controllers using 'Delegation' : Objective-C
- Unexpected CALayer Vertical Flipping on 3D Rotation 'Bounce'
- Setting View orientation to portrait is ignored
- UITextField append / between dates while enforcing character limit
Related Questions in COCOA
- How do I customize NSOutlineView to have border color?
- How to generate request format for WCF web service method for Mac and iPhone
- How to Handle Command Line Prompt from a Cocoa App
- Change views inside NSSplitViewController
- CMYK NSImage get pixel data
- Reactive Cocoa Conditional Split ?
- Set background color of NSImageView with proportionally sized image
- Use NSWindow or NSViewController?
- Imports and includes in header files - when is it okay?
- How to prevent the app from automatically open a window when launched?
- Swift NSViewController responds to mouseDown event, but not keyDown event
- "stringByAddingPercentEncodingWithAllowedCharacters" replaces more characters than it should
- cocoa - what happen when close a window (by pressing the red X button)?
- Does it necessary to go back to main thread to update UI?
- WebView not responding to Keyboard input
Related Questions in COPY-PASTE
- How do I extract info from crunchbase
- Copying data to a added worksheet
- Copy and Paste Hyperlink change path to absolute
- Clipboard.SetText not copying new line characters properly
- Copy/Paste dynamic range
- Cut + Paste behavior of folders in Windows 8.1
- VBA Using a userform data to copy from a workbook into a new workbook
- How to copy the entered text in dialog with button from code?
- Eclipse formatter changing comment indentation
- How can i display a toast message in the clipboard copy option click in android
- Paste screenshot into a textarea using Paste.js, but how would you transmit it to Rails?
- Why does my Copying only work on the First Loop?
- Copy and paste data from the next Excel sheet VBA
- Pasting values into DatetimePicker
- How to copy and paste indd file content into an another indd file?
Related Questions in APPKIT
- Using autolayout, how can I center a subview in an NSSplitView without forcing the width NSSplitView to be static?
- Prevent NSScrollView from flashing its scroller
- How to show NSTextView-like context menu
- NSSearchField occasionally causing an NSInternalInconsistencyException
- NSTextField draws white area after resigning first responder
- macOS AppKit: Strange dragging behavior of modeless NSSavePanel
- Sample NSImage and retain quality (swift 3)
- MacOS views rendering same font differently
- Hide the mouse in a Mac application after not moving it
- ViewController + Storyboard setting up validation with controlTextDidChange
- Why does NSLocale.current.identifier include currency on macOS?
- C Disable command-line input
- OSX Layout positioning from code cause wrong position
- NSScrollView how to start from top left corner
- Custom selection style for view based "Source List" NSOutlineView
Related Questions in NSPASTEBOARD
- NSRTFPboardType & paste into gmail browser window?
- Animated GIF into NSPasteboard
- NSPasteboard ops working but not DnD
- Reading from the clipboard with Swift 3 on macOS
- How to convert to id with conforming protocol?
- Get HTML of selected link in a Mac OS X Service
- Does NSPasteboard retain owner objects?
- Can I receive a callback whenever an NSPasteboard is written to?
- kPasteboardTypeFileURLPromise source example
- Error handling when keeping kPasteboardTypeFileURLPromise
- NSPasteBoard get file from the Download (Grid View) in dock via DragAndDrop to App Statusbar Icon
- NSOutlineView drag promises with directories
- NSPasteboard in Xamarin.Mac
- MacOS Service from SwiftUI App Not Showing Up
- Cut & paste of files with NSPasteboard
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can use
kPasteboardTypeFilePromiseContent. In this case, the dragging source is responsible to write the file to the destination, so you can move the file instead of duplicating it.Docs from
Pasteboard.h:Sample: