Hello All,

SaveLink app is not yet complete.

The 'open' method called from the command menu is working.
Also I improved the code using more specific Path handle methods:
NSString *nameLink = [[openPath lastPathComponent] stringByDeletingPathExtension];

But I must handle now the case when a '.url' file is selected and opened by SaveLink from the 'open-With' menu of GWorkspace to be edited.

So:
- I declared a new method: '(void) openWithPath: (NSString *) pathFile';
- I tried to call 'openWithPath:' from 'awakeFromNib' like this:

  NSLog(@"Enter...");
  NSArray *arguments = [[NSProcessInfo processInfo] arguments];

    // Check if there are any arguments passed
    if ([arguments count] > 1) {
        NSString *filePath = [arguments objectAtIndex:1];

        NSLog(@"File to open: %@", filePath);
        [self openWithPath: filePath];
    }
  NSLog(@"Out...");
}


It is working as expected from a Terminal Shell with: 'openapp SaveLink someFile.url'. But nothing happens if I use the 'openWith' menu with the same file within the FileViewer of GWorkspace. Even the app is not launching at all.

Here is the method:

- (void) openWithPath: (NSString *)pathFile;
{
  // Get Name of the Link
NSString *fileName = [[pathFile lastPathComponent] stringByDeletingPathExtension];
  [name setStringValue: fileName];

  // Get Link value
  NSString *content;
  content = [NSString stringWithContentsOfFile: pathFile];
  NSString *url =  [content substringFromIndex: 23];
  [link setStringValue: url];
  [savebutton setEnabled:YES];
}


Do you think we must handle a different count of args with 'openWith' menu case?

Best regards,
Patrick

--
Patrick Cardona - Pi500 - GNU/Linux aarch64 (Debian 13.3)
Xorg (1:7.7+24) - libcairo2 (1.18.4-1+rpt1 arm64) - Window Maker (0.96.0-4) GWorkspace (1.1.0 - 02 2025) - Theme: AGNOSTEP - Classic - MUA: GNUMail (1.4.0 - rev.947)


Reply via email to