Skip to content

Commit 34bcdae

Browse files
authored
Create design-in-memory-file-system.cpp
1 parent a35afcc commit 34bcdae

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

C++/design-in-memory-file-system.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class FileSystem {
88
public:
9-
FileSystem() : root_(new TrieNode()){
10-
mkdir("/");
9+
FileSystem() : root_(new TrieNode()) {
10+
1111
}
1212

1313
vector<string> ls(string path) {
@@ -75,7 +75,9 @@ class FileSystem {
7575
stringstream ss(s);
7676
string token;
7777
while (getline(ss, token, delim)) {
78-
tokens.emplace_back(token);
78+
if (!token.empty()) {
79+
tokens.emplace_back(token);
80+
}
7981
}
8082
return tokens;
8183
}

0 commit comments

Comments
 (0)