Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
d99ad9c0
Commit
d99ad9c0
authored
Jul 10, 2012
by
Elliott Sales de Andrade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix imports of files with names the same as a directory.
parent
038c77f9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
document.cpp
document.cpp
+15
-18
No files found.
document.cpp
View file @
d99ad9c0
...
...
@@ -5,6 +5,7 @@
#include "error.hpp"
#include <iostream>
#include <sstream>
#include <sys/stat.h>
namespace
Sass
{
...
...
@@ -30,28 +31,24 @@ namespace Sass {
{
std
::
FILE
*
f
;
const
char
*
path_str
=
path
.
c_str
();
f
=
std
::
fopen
(
path_str
,
"rb"
)
;
if
(
!
f
)
{
string
path_with_extension
(
path
+
".scss"
);
f
=
std
::
fopen
(
path_with_extension
.
c_str
(),
"rb"
);
if
(
!
f
)
{
const
char
*
file_name_str
=
Prelexer
::
folders
(
path_str
);
string
path_with_underscore
(
Token
::
make
(
path_str
,
file_name_str
).
to_string
()
+
struct
stat
st
;
if
(
stat
(
path_str
,
&
st
)
==
-
1
||
S_ISDIR
(
st
.
st_mode
)
)
{
path_str
=
(
path
+
".scss"
).
c_str
(
);
if
(
stat
(
path_str
,
&
st
)
==
-
1
||
S_ISDIR
(
st
.
st_mode
))
{
const
char
*
full_path_str
=
path
.
c_str
();
const
char
*
file_name_str
=
Prelexer
::
folders
(
full_
path_str
);
path_str
=
(
Token
::
make
(
full_
path_str
,
file_name_str
).
to_string
()
+
"_"
+
Token
::
make
(
file_name_str
).
to_string
());
f
=
std
::
fopen
(
path_with_underscore
.
c_str
(),
"rb"
);
if
(
!
f
)
{
string
path_with_underscore_and_extension
(
path_with_underscore
+
".scss"
);
f
=
std
::
fopen
(
path_with_underscore_and_extension
.
c_str
(),
"rb"
);
if
(
!
f
)
throw
path
;
string
(
file_name_str
)).
c_str
();
if
(
stat
(
path_str
,
&
st
)
==
-
1
||
S_ISDIR
(
st
.
st_mode
))
{
path_str
=
(
string
(
path_str
)
+
".scss"
).
c_str
();
if
(
stat
(
path_str
,
&
st
)
==
-
1
||
S_ISDIR
(
st
.
st_mode
))
throw
path
;
}
}
}
if
(
std
::
fseek
(
f
,
0
,
SEEK_END
))
throw
path
;
int
status
=
std
::
ftell
(
f
);
if
(
status
<
0
)
throw
path
;
size_t
len
=
status
;
std
::
rewind
(
f
);
f
=
std
::
fopen
(
path_str
,
"rb"
);
size_t
len
=
st
.
st_size
;
char
*
source
=
new
char
[
len
+
1
];
size_t
bytes_read
=
std
::
fread
(
source
,
sizeof
(
char
),
len
,
f
);
if
(
bytes_read
!=
len
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment