Commit 777a45d4 by Aaron Leung

Better include-path splitting and normalization.

parent 449aeeb3
......@@ -23,18 +23,30 @@ extern "C" char* sass_compile(sass_context* c_ctx)
const size_t wd_len = 1024;
char wd[wd_len];
cpp_ctx.include_paths.push_back(getcwd(wd, wd_len));
if (*cpp_ctx.include_paths.back().rbegin() != '/') cpp_ctx.include_paths.back() += '/';
if (c_ctx->include_paths) {
const char* beg = c_ctx->include_paths;
const char* end = Prelexer::find_first<':'>(beg);
while (end) {
cpp_ctx.include_paths.push_back(string(beg, end - beg));
string path(beg, end - beg);
if (!path.empty()) {
if (*path.rbegin() != '/') path += '/';
cpp_ctx.include_paths.push_back(path);
}
beg = end + 1;
end = Prelexer::find_first<':'>(beg);
}
cpp_ctx.include_paths.push_back(beg);
string path(beg);
if (!path.empty()) {
if (*path.rbegin() != '/') path += '/';
cpp_ctx.include_paths.push_back(path);
}
for (int i = 0; i < cpp_ctx.include_paths.size(); ++i) {
cerr << cpp_ctx.include_paths[i] << endl;
}
}
Document doc(c_ctx->input_file, c_ctx->input_string, cpp_ctx);
......
......@@ -30,7 +30,7 @@ int main(int argc, char** argv)
struct sass_context* ctx = sass_new_context();
ctx->sass_path = NULL;
ctx->css_path = NULL;
ctx->include_paths = NULL;
ctx->include_paths = "::/blah/bloo/fuzz:/slub/flub/chub::/Users/Aaron/dev/libsass/::::/huzz/buzz:::";
ctx->output_style = 0;
ctx->input_file = argv[1];
ctx->input_string = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment