when I look up in nautilus for a Desktop file it has the filename showed below:
Then I open in terminal and search for the same file, I found it has another name showed below:
Anybody knows why it is like this?
Thanks in advance
This is specific to .desktop files.
In GNOME and other freedesktop.org-compliant desktops, an application
gets registered into the desktop's menus through a desktop entry,
which is a text file with .desktop extension. This desktop file
contains a listing of the configurations for your application.
More information can be found here https://developer.gnome.org/integration-guide/stable/desktop-files.html.en
Related
I am used on OSX to use CMD-Shift-g to open a Go to Folder window. What fundamentally does, is to open a file in a location without me using the mouse to navigate to a different directory. I paste the path of a file, like if I am loading a PSD in Photoshop, and I can load the file, independently from where my current directory is pointing at.
Is there an equivalent to this in Windows? Like if I have a file open prompt in Photoshop (or any other windows app, for what matters), that is pointing at my desktop, while my file is in some other location, and I can pass the full path of the file, like I do on OSX with the go to folder window?
I found a "workaround". Windows fundamentally accept in the file name textfield, the full path too; so if you are on desktop for example, and in the file name field you type the full path of the file, it will in fact change the current directory to the full path you pass.
Works in a similar way but without the need to call a window to just change the path.
How to create a .vm (velocity template file) from command line in Windows
Based on you comment I assume what you really mean is how to made file which by default opens with some specific program you have. Here is several thing to be taken into account:
To create .vm file from command line you can use this question
By default windows doesn't show file extensions in explorer - so you won't actually see that it is .vm file in explorer. Reffer this guide to show file extensions.
There is such thing as file associations - e.g. default program to be use when you open file (for example double click). Also this affect icon shown for the file in explorer.
So to summarize - file created from command line(using method from referred question) have .vm extension. You don't see this cause your windows settings doesn't show extensions. You assume it is text file cause notepad++ icon shown for it as well as it opens with notepad++. That's a wrong assumption - simple you have notepad++ associated to open .vm files. If you want to use different program - you need either:
Change file associations (see link above).
Use open with option to open file with another program (right click menu option)
Use Open function from inside your program.
I have created a go application on my mac that reads/writes from files *.myext. The executable was packed into an a Bundle called "MyApp".
I can start MyApp and then read/write *.myext files, that works.
My question is: how to detect the filename if I am opening e.g. test.myext by Open With > MyApp (usually right mouse button)?
I have tried to read the file name from os.Args, but the file name is not in there.
Is there a way?
Thank you for your help!
Leo
Looks like a program started via "Open With" does not receive the name of the file it has been invoked on but rather has to obtain it using "Apple events" as described in the accepted answer here.
I am thereby afraid currently the only way to solve the problem would be to use cgo; may be along these lines.
Does anyone suggest a freeware tool/script/manual_way of creating Dropbox like DMG -
Need to ask couple of questions --
I want double clicking the Folder-Icon should copy the folder(which would contain installer and uninstaller .app files of my application) into the system's /Applications folder.
Solution -- This has been solved using Applescript and changing icon of that applescript file to the folder-icon(i.e double clicking that script will move our folder(which would be present in a hidden folder) to /Applications.Any suggestions for second and third part?
Is it possible to show hyperlink of actual dropbox.com to actually open it's website?
And how we can customize volume's/Drive icon?
You can find a way to do it by reading this: Packaging a Mac OS X Application Using a DMG ยป asmaloney.com
I believe you can also use the trick of naming a shellscript file something.command in order to make it double clickable, (but maybe it will open the terminal, -I haven't tried it).
I want to be able to run a text editor from my app, as given by the user in the TEXT_EDITOR environment variable. Now, assuming there is nothing in that variable, I want to default to the TextEdit program that ships with OSX. Is it kosher to hardcode /Applications/TextEdit.app/Contents/MacOS/TextEdit into my app, or is there a better way to call the program?
Edit: For the record, I am limited to running a specific application path, in C. I'm not opening a path to a text file.
Edit 2: Seriously people, I'm not opening a file here. I'm asking about an application path for a reason.
In your second edit it makes it sound like you just want to get the path to TextEdit, this can be done easily by using NSWorkspace method absolutePathForAppBundleWithIdentifier:
NSString *path = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:#"com.apple.TextEdit"];
Mac OS X has a mechanism called "uniform type identifiers" that it uses to track associations between data types and applications that can handle them. The subsystem that manages this is Launch Services. You can do one of two things:
If you have a file with a reasonably well-known path extension, e.g. .txt, you can just ask NSWorkspace to open the file in the appropriate application.
If you don't have a well-known path extension, but you know the type of data, you can ask Launch Services to look up the default application for that type, and then ask NSWorkspace to open the file in that specific application.
If you do it this way you'll get the same behavior as the Finder, and you won't have to fork()/exec() or use system() just to open a file.
I believe hardcoding "Applications" will not work if the user's language setting is not English. For example in Norsk the "Applications" folder is named "Programmer".
The Apple document on internationalization is here. Starting on page 45 is a section on handling localized path names.
I believe that Mac OS X provides a default application mechanism, so that .txt will open in TextEdit.app or Emacs or GVim or whatever the user has specified. I couldn't find anything online however.
You could run following command from your application:
open <full path to text file>
This will open the text file in the default text editor. You can open any file type using open command.