mirror of
				https://github.com/janet-lang/janet
				synced 2025-11-04 01:23:04 +00:00 
			
		
		
		
	Don't fail jpm if os/realpath fails.
This commit is contained in:
		
							
								
								
									
										21
									
								
								jpm
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								jpm
									
									
									
									
									
								
							@@ -22,6 +22,19 @@
 | 
				
			|||||||
###START###
 | 
					###START###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Overriden on some installs.
 | 
					# Overriden on some installs.
 | 
				
			||||||
 | 
					# To configure this script, replace the code between
 | 
				
			||||||
 | 
					# the START and END comments and define a function 
 | 
				
			||||||
 | 
					# (install-paths) that gives the the default paths
 | 
				
			||||||
 | 
					# to use. Trailing directory separator not expected.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Example.
 | 
				
			||||||
 | 
					# 
 | 
				
			||||||
 | 
					#   (defn- install-paths []
 | 
				
			||||||
 | 
					#     {:headerpath "/usr/local/include/janet"
 | 
				
			||||||
 | 
					#      :libpath "/usr/local/lib/janet"
 | 
				
			||||||
 | 
					#      :binpath "/usr/local/bin"
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(def- exe-dir
 | 
					(def- exe-dir
 | 
				
			||||||
  "Directory containing jpm script"
 | 
					  "Directory containing jpm script"
 | 
				
			||||||
  (do
 | 
					  (do
 | 
				
			||||||
@@ -29,9 +42,13 @@
 | 
				
			|||||||
    (def i (last (string/find-all sep exe)))
 | 
					    (def i (last (string/find-all sep exe)))
 | 
				
			||||||
    (slice exe 0 i)))
 | 
					    (slice exe 0 i)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defn- try-real [path]
 | 
				
			||||||
 | 
					  "If os/realpath fails just use normal path."
 | 
				
			||||||
 | 
					  (try (os/realpath) ([_] path)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defn- install-paths []
 | 
					(defn- install-paths []
 | 
				
			||||||
  {:headerpath (os/realpath (string exe-dir "/../include/janet"))
 | 
					  {:headerpath (try-real (string exe-dir "/../include/janet"))
 | 
				
			||||||
   :libpath (os/realpath (string exe-dir "/../lib"))
 | 
					   :libpath (try-real (string exe-dir "/../lib"))
 | 
				
			||||||
   :binpath exe-dir})
 | 
					   :binpath exe-dir})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###END###
 | 
					###END###
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user