Merge pull request #1387 from bennofs/nix-ls-slash
nix ls: support '/' for the root directory
This commit is contained in:
		
						commit
						0124d118ef
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -61,6 +61,10 @@ struct MixLs : virtual Args
 | 
				
			||||||
                showFile(curPath, relPath);
 | 
					                showFile(curPath, relPath);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (path == "/") {
 | 
				
			||||||
 | 
					            path = "";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        auto st = accessor->stat(path);
 | 
					        auto st = accessor->stat(path);
 | 
				
			||||||
        if (st.type == FSAccessor::Type::tMissing)
 | 
					        if (st.type == FSAccessor::Type::tMissing)
 | 
				
			||||||
            throw Error(format("path ‘%1%’ does not exist") % path);
 | 
					            throw Error(format("path ‘%1%’ does not exist") % path);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue