Re: starting an app bundle natively - NSWorkspace launchApplication

2024-07-08 Thread Riccardo Mottola

Hi,

Fred Kiefer wrote:

This could be handled by openFile:withApplication: in the same class. What I 
don’t see is how you could use any of this mechanisms for command completion 
but that is another question.


the code looks for app bundles in standard locations () or analyzes the 
current directory typed in by the user. The code maybe not perfect, but 
appears to work. I added ".app" support.
Probably it can benefit of at least partial caching. You can look at it, 
I opened a PR on my own branch, so we can collaborate on it.


I extracted a lot of code (without changing functionality) between "Run" 
and "OpenWith". This makes things clearer... however I found some 
differences which I want to understand, so that further duplication can 
be eliminated.


Riccardo



Re: starting an app bundle natively - NSWorkspace launchApplication

2024-07-03 Thread Fred Kiefer



> Am 04.07.2024 um 00:06 schrieb Riccardo Mottola :
> 
> 
> Fred Kiefer wrote:
>>> is NSWorkspace's launchApplication the best answer?
>> Yes, to me this sounds like the right way to go.
> 
> indeed, it works for running. It didn't yesterday because of some stupid 
> mistake of mine.
> 
> However, GWorkspace has also "open with" where one wants to open certain 
> files wtih a certain application.
> So I can't just "open the file" because it would open the default one.
> I do need to give the file name parameter. is it possible?

This could be handled by openFile:withApplication: in the same class. What I 
don’t see is how you could use any of this mechanisms for command completion 
but that is another question.

Cheers,
Fred




Re: starting an app bundle natively - NSWorkspace launchApplication

2024-07-03 Thread Riccardo Mottola

Hi Fred,

Fred Kiefer wrote:

is NSWorkspace's launchApplication the best answer?

Yes, to me this sounds like the right way to go.


indeed, it works for running. It didn't yesterday because of some stupid 
mistake of mine.


However, GWorkspace has also "open with" where one wants to open certain 
files wtih a certain application.

So I can't just "open the file" because it would open the default one.
I do need to give the file name parameter. is it possible?

Riccardo



Re: starting an app bundle natively - NSWorkspace launchApplication

2024-07-03 Thread Fred Kiefer



> Am 02.07.2024 um 22:15 schrieb Riccardo Mottola :
> 
> Hi,
> 
> is there a way to start an application - as in GNUstep or mac app bundle - 
> natively from?
> Something that would be the equivalent of gopen/openapp essentially.
> 
> To start a normal executable I can use NSTask.
> I see two ways to implement it - search for the executable (GNUstep has tools 
> equivalents, but not mac) and then run NSTask on it as a standard executable 
> or use NSTask with openapp and the name as argument, but both are "kludges" 
> in my opinion, involving some work.
> 
> is NSWorkspace's launchApplication the best answer?

Yes, to me this sounds like the right way to go.

Fred