Detect grabbed file systemwide with coordinates and path to file - objective-c

Can i detect the coordinates and pathinfo of a file / files, when the user starts to move a file somewhere?
(Pressing and holding left-mouse on file)
Objective-C or Swift

This info may be found in NSDragPboard pasteboard. The filenames are usually located in NSFilenamesPboardType. Take a look at Apple's ClipboardViewer sources, it might be useful for you.

Related

Convert .bin to .png for files located in word/embedding of a word.zip file

I am stuck at this problem for some hours now.
I have a wordfile with embedded OLE objects. The OLE-Objects are PNG-files.
I unzipped the word-file via renaming it to .zip and found the files I need via \document.xml and _rels\document.xml.rels whereby I could identify the needed OLE-Object in the documents.xml and the r:id under <v:imagedata> linked to the respective OLE-Object in the document.xml.rels.
Now when I open the OLE-Object via the word file, it is recognized as expected as a PNG. When I look it up under \embeddings\oleObject1.bin, it is no longer a png, but a bin instead.
Now simply renaming the bin to png does not work...
My question would be: How do I turn this bin into a graphics format I can use?
Thank you very much!
*.bin streams are themselves zip archives. When you extract them you will find their true contents along with some meta-data.

Domain=NSCocoaErrorDomain Code=513 only when rename folder through UITests target for UI Autoamtion

I am developing a product like DropBox and Box application, and I need to verify Rename/Add/Delete I/O operation using automation.
I am writing UI Automation Test Cases using XCUITest in Xcode.
In that I need to use I/O operation for rename file/folder but It gives the below error while using moveItemAtPath function to rename folder:
Error Domain=NSCocoaErrorDomain Code=513 "“Folder” couldn’t be moved because you don’t have permission to access “Folder1”." UserInfo={NSSourceFilePathErrorKey=*path, NSUserStringVariant=(
Move), NSDestinationFilePath=*destiPath, NSFilePath=*path, NSUnderlyingError=0x6000002507d0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
Its working fine when running the app in main target and also its working in UnitTest target but its not working while running UITest automation target.
NOTE: App Groups are also enabled.
Any help is appreciated!
Try changing the folder you writing to or in your case i dont know why you're renaming the folder. If you've to do something to your folder then perhaps having that folder in one of these locations Documents, Temp and Cache. Most likely, you will want to write to the Documents folder.
It seems to me like a codesign error. Refer this post NSFileManager creating folder (Cocoa error 513.)
Try this below approach. I'm quoting apple documentation - https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW22
Scenario 1:
Your app needs to be able to save a file with a different extension than that of the original file. For example, when you paste an image into an RTF file in TextEdit and save it, TextEdit changes the file’s extension from .rtf to .rtfd (and it becomes a directory).
To handle this situation, you must use an NSFileCoordinator object to coordinate access to the file. Before you rename the file, call the itemAtURL:willMoveToURL: method. After you rename the file, call the itemAtURL:didMoveToURL: method.
Scenario 2:
Your app needs to be able to open or save multiple related files with the same name and different extensions (for example, to automatically open a subtitle file with the same name as a movie file, or to allow for a SQLite journal file).
To gain access to that secondary file, create a class that conforms to the NSFilePresenter protocol. This object should provide the main file’s URL as its primaryPresentedItemURL property, and should provide the secondary file’s URL as its presentedItemURL property.
After the user opens the main file, your file presenter object should call the addFilePresenter: class method on the NSFileCoordinator class to register itself.
In both scenarios, you must make a small change to the application’s Info.plist file. Your app should already declare a Document Types (CFBundleDocumentTypes) array that declares the file types your app can open.
For each file type dictionary in that array, if that file type should be treated as a potentially related type for open and save purposes, add the key NSIsRelatedItemType with a boolean value of YES.
To learn more about file presenters and file coordinators, read File System Programming Guide.

How to use ctags for code documentation

I have some source code that I want to document without touching the code. For every source file (e.g., example.cpp, example.f90, etc.) I would like to have a separate documentation file (e.g., example.cpp.doc, example.f90.doc) that has some metadata (ctag) linking it to the original source file.
Ideally I could open the source file and the documentation file in parallel views in my favorite editor (ViM) and have the two files synced so that they scroll together. In this manner, I can keep my documentation visually inline with the un-touched source code.
I know this is likely to be a unique scenario. But I'm hoping someone else has already figured this out.
Is this even a possibility?
Create the initial .doc structure outside of Vim such that the "metadata" you want to keep is in the same line number as the original file.
Then open the two files in different Vim windows with vim -O example.cpp example.cpp.doc. At this point use :windo set scrollbind to enable scroll binding, which will allow to navigate any of the windows while keeping both in sync.

vwnt pop up in smalltalk

When I try to open my smalltalk project file vwnt pops up. The project wont open. I did save the project properly last time I was working on it. Please help if anyone know how to resolve this issue.
what do you mean by smalltalk project files? VisualWorks doesn't have anything like that. What it has is an .im and .cha file. the .im file is the image, which contains VisualWorks and all the changes you did to it. So when you open the .im file, it'll open VisualWorks. You create classes and methods in VisualWorks and by doing so you modify the whole system. When you save the image, the whole VisualWorks system gets persisted and when you open the image file again, the system is restored.
The .cha file is a text file that contains all the changes that you did to the image.

Are Objective-C function names stored in text?

I don't remember where I heard about it, (I think I was searching up on how selectors worked and it ended up not being exactly the same as a callback function) and I can't confirm it. But more importantly than that, is there a way I could get a list of the function names from another application?
See class-dump.
You can sometimes see a list of the method names in an application. Find the .ipa file for the app (possibly in the Music->iTunes->Mobile Applications directory on a Mac). Make a copy of one of the ipa files and change it from .ipa to .zip. Unzip the file and in the Payload folder, there's a file with the same name as the app. Right click on it and "Show Package Contents". In there, you'll find another file with the same name as the app (with no extension). This is the executable file for the app. If you open it in a text editor like BBEdit, you'll sometimes be able to see some method names, as well as a list of the frameworks the app is built against. You can find the path name where things were kept too, often with the developer's name.
For example, looking into the Japanese dicitonary Daijirin, I can see these methods:
-[HMWebSupport openMONOKAKIDOSupportWithSafariForView:style:]
-[HistoryViewController viewWillAppear:]
I can also see that one of the developers was called Norihito, and he was using SVN: /Users/norihito/Developer/SVN/Mobile/DAIJIRIN/Other
Other applications (like Weightbot) don't show as much information. I don't know the reason it shows up some times and doesn't other times.