Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nora Puchreiner
Nix
Commits
5d4b90b6
Commit
5d4b90b6
authored
21 years ago
by
Eelco Dolstra
Browse files
Options
Downloads
Patches
Plain Diff
* Actually go through the search directories when looking for files.
parent
089b4361
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fix.cc
+23
-9
23 additions, 9 deletions
src/fix.cc
with
23 additions
and
9 deletions
src/fix.cc
+
23
−
9
View file @
5d4b90b6
...
...
@@ -10,6 +10,24 @@
typedef
ATerm
Expr
;
static
Strings
searchDirs
;
static
string
searchPath
(
string
relPath
)
{
for
(
Strings
::
iterator
i
=
searchDirs
.
begin
();
i
!=
searchDirs
.
end
();
i
++
)
{
string
path
=
*
i
+
"/"
+
relPath
;
if
(
pathExists
(
path
))
return
path
;
}
throw
Error
(
format
(
"path `%1%' not found in any of the search directories"
)
%
relPath
);
}
static
Expr
evalFile
(
string
fileName
);
...
...
@@ -108,7 +126,7 @@ static Expr evalExpr(Expr e)
/* Relative files. */
if
(
ATmatch
(
e
,
"Relative(<str>)"
,
&
s1
))
{
string
srcPath
=
s
1
;
string
srcPath
=
s
earchPath
(
s1
)
;
string
dstPath
;
Hash
hash
;
addToStore
(
srcPath
,
dstPath
,
hash
);
...
...
@@ -198,13 +216,9 @@ static Expr evalExpr(Expr e)
}
static
Strings
searchPath
;
static
Expr
evalFile
(
string
fileName
)
static
Expr
evalFile
(
string
relPath
)
{
Expr
e
=
ATreadFromNamedFile
(
fileName
.
c_str
());
if
(
!
e
)
throw
Error
(
format
(
"cannot read aterm `%1%'"
)
%
fileName
);
Expr
e
=
ATreadFromNamedFile
(
searchPath
(
relPath
).
c_str
());
return
evalExpr
(
e
);
}
...
...
@@ -213,7 +227,7 @@ void run(Strings args)
{
Strings
files
;
search
Path
.
push_back
(
"."
);
search
Dirs
.
push_back
(
"."
);
for
(
Strings
::
iterator
it
=
args
.
begin
();
it
!=
args
.
end
();
)
...
...
@@ -223,7 +237,7 @@ void run(Strings args)
if
(
arg
==
"--includedir"
||
arg
==
"-I"
)
{
if
(
it
==
args
.
end
())
throw
UsageError
(
format
(
"argument required in `%1%'"
)
%
arg
);
search
Path
.
push_back
(
*
it
++
);
search
Dirs
.
push_back
(
*
it
++
);
}
else
if
(
arg
[
0
]
==
'-'
)
throw
UsageError
(
format
(
"unknown flag `%1%`"
)
%
arg
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment