24 lines
		
	
	
		
			599 B
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			24 lines
		
	
	
		
			599 B
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								文件名:String.nut
							 | 
						||
| 
								 | 
							
								路径:Core/BaseTool/String.nut
							 | 
						||
| 
								 | 
							
								创建日期:2024-11-28	23:05
							 | 
						||
| 
								 | 
							
								文件用途:
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								class String {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    //将含有../的路径转为真实路径
							 | 
						||
| 
								 | 
							
								    function RegRealPath(Path) {
							 | 
						||
| 
								 | 
							
								        if (Path.find("../") != null) {
							 | 
						||
| 
								 | 
							
								            while (true) {
							 | 
						||
| 
								 | 
							
								                local rbuf = regexp("[^/]+/../");
							 | 
						||
| 
								 | 
							
								                local Ret = rbuf.capture(Path);
							 | 
						||
| 
								 | 
							
								                if (Ret) {
							 | 
						||
| 
								 | 
							
								                    Path = Path.slice(0, Ret[0].begin) + Path.slice(Ret[0].end);
							 | 
						||
| 
								 | 
							
								                } else {
							 | 
						||
| 
								 | 
							
								                    return Path;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return Path;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |