Home » Developing U++ » U++ Developers corner » Different getenv("PATH") and $PATH on macos M1 (for libclang.dylib)  
	
		
		
			| Re: Different getenv("PATH") and $PATH on macos  [message #59490 is a reply to message #59487] | 
			Thu, 05 January 2023 16:37    | 
		 
		
			
				
				
				
					
						  
						Oblivion
						 Messages: 1240 Registered: August 2007 
						
					 | 
					Senior Contributor  | 
					 | 
		 
		 
	 | 
 
	
		Hi, 
 
Quote:I had seen that link before I posted but I could not to digest. That's why I posted here. It is not about setting the PATH. It is about getting the PATH. We are not going to ask every theide user to set "sudo launchctl config user path", aren't we? Moreover, the PATH is set. I can get it on terminal with 'echo $PATH' without problems. The questions is - how to get it programatically with upp the right way. getenv used inside ide is the wrong way. 
P.S. for some reasons this doesn't work: 
  
 
Since $PATH is not part of  unix echo command, it is a *shell* variable, it is actually  the responsibility of shell to replace it with the actual path here. You need to run the command via a shell so that it can inherit the shell's env, and the shell can replace the variable with the output.  
 
And using bash does not seem optimal here, AFAIK the practice is to symlink sh to the preferred shell installed on the system. 
 
 
Sys("sh -c \'echo $PATH\'");
 
 
should work. 
 
Best regards, 
Oblivion
		
		
  Github page: https://github.com/ismail-yilmaz 
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
		
 |  
	| 
		
	 | 
 
 
 |  
  
 
	
	  | 
	 | 
	
		Different getenv("PATH") and $PATH on macos M1 (for libclang.dylib)
		By:  fudadmin on Wed, 04 January 2023 04:36  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  Novo on Thu, 05 January 2023 02:23  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  fudadmin on Thu, 05 January 2023 05:43  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  fudadmin on Thu, 05 January 2023 07:03  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  Oblivion on Thu, 05 January 2023 16:37  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  fudadmin on Thu, 05 January 2023 23:37  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  Novo on Thu, 05 January 2023 18:47  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  fudadmin on Fri, 06 January 2023 00:05  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  Novo on Fri, 06 January 2023 06:06  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  fudadmin on Fri, 06 January 2023 09:47  
	 | 
 
	  | 
	 | 
	
		Re: Different getenv("PATH") and $PATH on macos 
		By:  Novo on Tue, 10 January 2023 16:43  
	 | 
  
Goto Forum:
 
 Current Time: Tue Nov 04 06:58:37 CET 2025 
 Total time taken to generate the page: 0.00343 seconds 
 |