os: is_abs => is_abs_path
							parent
							
								
									324a48bc64
								
							
						
					
					
						commit
						8ff86dbee6
					
				| 
						 | 
				
			
			@ -105,13 +105,13 @@ pub fn (v &V) finalize_compilation() {
 | 
			
		|||
pub fn (v mut V) add_parser(parser Parser) int {
 | 
			
		||||
	pidx := v.parsers.len
 | 
			
		||||
	v.parsers << parser
 | 
			
		||||
	file_path := if os.is_abs(parser.file_path) { parser.file_path } else { os.realpath(parser.file_path) }
 | 
			
		||||
	file_path := if os.is_abs_path(parser.file_path) { parser.file_path } else { os.realpath(parser.file_path) }
 | 
			
		||||
	v.file_parser_idx[file_path] = pidx
 | 
			
		||||
	return pidx
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn (v &V) get_file_parser_index(file string) ?int {
 | 
			
		||||
	file_path := if os.is_abs(file) { file } else { os.realpath(file) }
 | 
			
		||||
	file_path := if os.is_abs_path(file) { file } else { os.realpath(file) }
 | 
			
		||||
	if file_path in v.file_parser_idx {
 | 
			
		||||
		return v.file_parser_idx[file_path]
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -950,8 +950,8 @@ pub fn realpath(fpath string) string {
 | 
			
		|||
	return string(fullpath)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// is_abs returns true if `path` is absolute.
 | 
			
		||||
pub fn is_abs(path string) bool {
 | 
			
		||||
// is_abs_path returns true if `path` is absolute.
 | 
			
		||||
pub fn is_abs_path(path string) bool {
 | 
			
		||||
	$if windows {
 | 
			
		||||
		return path[0] == `/` || // incase we're in MingGW bash
 | 
			
		||||
		(path[0].is_letter() && path[1] == `:`)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -278,11 +278,11 @@ fn test_ext() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
fn test_is_abs() {
 | 
			
		||||
	assert os.is_abs('/home/user') == true
 | 
			
		||||
	assert os.is_abs('v/vlib') == false
 | 
			
		||||
	assert os.is_abs_path('/home/user') == true
 | 
			
		||||
	assert os.is_abs_path('v/vlib') == false
 | 
			
		||||
 | 
			
		||||
	$if windows {
 | 
			
		||||
		assert os.is_abs('C:\\Windows\\') == true
 | 
			
		||||
		assert os.is_abs_path('C:\\Windows\\') == true
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue