From a4da1a1b5a69751937db16faacccd610c4e1e895 Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Wed, 2 Apr 2025 01:46:40 +0200 Subject: [PATCH] Fix standardizing absolute paths: first check for them, then add CWD then standardize the path. As we are, add a nil/empty string check for path. --- Tools/gopen.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Tools/gopen.m b/Tools/gopen.m index 3a635adaa..6bbdec407 100644 --- a/Tools/gopen.m +++ b/Tools/gopen.m @@ -1,9 +1,10 @@ /* This tool opens the appropriate application from the command line based on what type of file is being accessed. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Software Foundation, Inc. - Written by: Gregory Casamento + Written by: Gregory Casamento + Riccardo Mottola Created: November 2001 This file is part of the GNUstep Project @@ -45,11 +46,12 @@ static NSString* absolutePath(NSFileManager *fm, NSString *path) { + if (nil == path || [path length] == 0) + return path; + + if (![path isAbsolutePath]) + path = [[fm currentDirectoryPath] stringByAppendingPathComponent: path] ; path = [path stringByStandardizingPath]; - if ([path isAbsolutePath] == NO) - { - path = [[fm currentDirectoryPath] stringByAppendingPathComponent: path]; - } return path; }