Hello Guest

Open With in windows and linux

  • 6 Replies
  • 9937 Views
*

Offline tlf30

  • **
  • 73
Open With in windows and linux
« 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.

Re: Open With in windows and linux
« Reply #1 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.

*

Offline tlf30

  • **
  • 73
Re: Open With in windows and linux
« Reply #2 on: January 14, 2012, 02:51:48 »
The txt was an example, im using akfw and akfa.

Re: Open With in windows and linux
« Reply #3 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.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

*

Offline tlf30

  • **
  • 73
Re: Open With in windows and linux
« Reply #4 on: January 19, 2012, 17:30:14 »
Thank, but how does the program know what file you are running it from.

Re: Open With in windows and linux
« Reply #5 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.
« Last Edit: January 19, 2012, 18:31:24 by Fool Running »
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

*

Offline tlf30

  • **
  • 73
Re: Open With in windows and linux
« Reply #6 on: January 19, 2012, 19:00:12 »
cool thanks!