parent
							
								
									a8edf185a9
								
							
						
					
					
						commit
						39d72640c2
					
				
					 8 changed files with 33 additions and 18 deletions
				
			
		|  | @ -35,11 +35,11 @@ bool parseOptionArg(const string & arg, Strings::iterator & i, | |||
| 
 | ||||
| 
 | ||||
| bool parseSearchPathArg(const string & arg, Strings::iterator & i, | ||||
|     const Strings::iterator & argsEnd, EvalState & state) | ||||
|     const Strings::iterator & argsEnd, Strings & searchPath) | ||||
| { | ||||
|     if (arg != "-I") return false; | ||||
|     if (i == argsEnd) throw UsageError(format("`%1%' requires an argument") % arg);; | ||||
|     state.addToSearchPath(*i++, true); | ||||
|     searchPath.push_back(*i++); | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,9 +8,9 @@ namespace nix { | |||
| bool parseOptionArg(const string & arg, Strings::iterator & i, | ||||
|     const Strings::iterator & argsEnd, EvalState & state, | ||||
|     Bindings & autoArgs); | ||||
|      | ||||
| 
 | ||||
| bool parseSearchPathArg(const string & arg, Strings::iterator & i, | ||||
|     const Strings::iterator & argsEnd, EvalState & state); | ||||
|     const Strings::iterator & argsEnd, Strings & searchPath); | ||||
| 
 | ||||
| Path lookupFileArg(EvalState & state, string s); | ||||
| 
 | ||||
|  |  | |||
|  | @ -153,7 +153,7 @@ static Symbol getName(const AttrName & name, EvalState & state, Env & env) | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| EvalState::EvalState() | ||||
| EvalState::EvalState(const Strings & _searchPath) | ||||
|     : sWith(symbols.create("<with>")) | ||||
|     , sOutPath(symbols.create("outPath")) | ||||
|     , sDrvPath(symbols.create("drvPath")) | ||||
|  | @ -219,11 +219,10 @@ EvalState::EvalState() | |||
| #endif | ||||
| 
 | ||||
|     /* Initialise the Nix expression search path. */ | ||||
|     searchPathInsertionPoint = searchPath.end(); | ||||
|     Strings paths = tokenizeString<Strings>(getEnv("NIX_PATH", ""), ":"); | ||||
|     foreach (Strings::iterator, i, paths) addToSearchPath(*i); | ||||
|     for (auto & i : _searchPath) addToSearchPath(i); | ||||
|     for (auto & i : paths) addToSearchPath(i); | ||||
|     addToSearchPath("nix=" + settings.nixDataDir + "/nix/corepkgs"); | ||||
|     searchPathInsertionPoint = searchPath.begin(); | ||||
| 
 | ||||
|     createBaseEnv(); | ||||
| } | ||||
|  |  | |||
|  | @ -113,11 +113,10 @@ private: | |||
| 
 | ||||
|     typedef list<std::pair<string, Path> > SearchPath; | ||||
|     SearchPath searchPath; | ||||
|     SearchPath::iterator searchPathInsertionPoint; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|     EvalState(); | ||||
|     EvalState(const Strings & _searchPath); | ||||
|     ~EvalState(); | ||||
| 
 | ||||
|     void addToSearchPath(const string & s, bool warn = false); | ||||
|  |  | |||
|  | @ -629,7 +629,7 @@ void EvalState::addToSearchPath(const string & s, bool warn) | |||
|     path = absPath(path); | ||||
|     if (pathExists(path)) { | ||||
|         debug(format("adding path `%1%' to the search path") % path); | ||||
|         searchPath.insert(searchPathInsertionPoint, std::pair<string, Path>(prefix, path)); | ||||
|         searchPath.push_back(std::pair<string, Path>(prefix, path)); | ||||
|     } else if (warn) | ||||
|         printMsg(lvlError, format("warning: Nix search path entry `%1%' does not exist, ignoring") % path); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue