fix: correct trim path (#22)
This commit is contained in:
		
							parent
							
								
									de22014785
								
							
						
					
					
						commit
						ce5d421c98
					
				@ -19,10 +19,15 @@ H.library_path = function()
 | 
				
			|||||||
  return dirname .. ("../build/?.%s"):format(ext)
 | 
					  return dirname .. ("../build/?.%s"):format(ext)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---@type fun(s: string): string
 | 
				
			||||||
 | 
					local trim_semicolon = function(s)
 | 
				
			||||||
 | 
					  return s:sub(-1) == ";" and s:sub(1, -2) or s
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M.load = function()
 | 
					M.load = function()
 | 
				
			||||||
  local library_path = H.library_path()
 | 
					  local library_path = H.library_path()
 | 
				
			||||||
  if not string.find(package.cpath, library_path, 1, true) then
 | 
					  if not string.find(package.cpath, library_path, 1, true) then
 | 
				
			||||||
    package.cpath = package.cpath .. ";" .. library_path
 | 
					    package.cpath = trim_semicolon(package.cpath) .. ";" .. library_path
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user