LWJGL Forum

Programming => General Java Game Development => Topic started by: tlf30 on January 14, 2012, 00:51:33

Title: Open With in windows and linux
Post by: tlf30 on January 14, 2012, 00:51:33
I'm trying to build a program that will open a custom file format. I was wondering if there was a way to open the file with the program like how you can open a .txt by clicking open on the file in windows and linux.
Title: Re: Open With in windows and linux
Post by: CodeBunny on January 14, 2012, 02:30:26
I'm not sure how to do it, but I'd recommend switching to a custom file extension. If you give a user the program and they install it, they might get pissed that they see the option for every single text file.
Title: Re: Open With in windows and linux
Post by: tlf30 on January 14, 2012, 02:51:48
The txt was an example, im using akfw and akfa.
Title: Re: Open With in windows and linux
Post by: Fool Running on January 19, 2012, 13:40:39
On windows, it requires writing values to the registry (HKEY_CLASSES_ROOT has the information). I'm not sure about Linux, but it is probably a file somewhere.
Title: Re: Open With in windows and linux
Post by: tlf30 on January 19, 2012, 17:30:14
Thank, but how does the program know what file you are running it from.
Title: Re: Open With in windows and linux
Post by: Fool Running on January 19, 2012, 18:29:19
The file name is passed on the command-line. For instance, in Windows, you specify the command to run when opening a file (located in the registry).
This is an example using my mapping for a Visual Studio .sln file. It will run:
Code: [Select]
"C:\Program Files\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe" "%1"
The '%1' gets replaced with the file that the user opened.
Title: Re: Open With in windows and linux
Post by: tlf30 on January 19, 2012, 19:00:12
cool thanks!