Skip to content

Commit f1678ce

Browse files
committed
linux mkdir--ok
1 parent 77a3a66 commit f1678ce

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

file_system.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
//===============For Linux=================
4141

42-
#ifdef _linux_
42+
#ifdef linux
4343

4444
#include <sys/stat.h>
4545
#include <sys/types.h>
@@ -65,7 +65,7 @@
6565
{
6666
return true;
6767
}
68-
mkdir(dirName, S_IRWXG);
68+
mkdir(dirName, 0777);
6969
return dirExists(dirName);
7070
}
7171

makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
main: util.o info.o basic.o def.o env.o interaction.o progress.o sentences.o stats.o strategy.o test.o main_interface.o program.o user.o settings.o factory.o
2-
g++ -o final util.o info.o basic.o def.o env.o interaction.o progress.o sentences.o stats.o strategy.o test.o user.o main_interface.o program.o settings.o factory.o
1+
main: util.o info.o basic.o def.o env.o interaction.o progress.o sentences.o stats.o strategy.o test.o main_interface.o program.o user.o settings.o factory.o file_system.o
2+
g++ -o final util.o info.o basic.o def.o env.o interaction.o progress.o sentences.o stats.o strategy.o test.o user.o main_interface.o program.o settings.o factory.o file_system.o
33
interaction.o: interaction.cpp util.h def.h strategy.h env.h sentences.h
44
g++ -c -g interaction.cpp
55
util.o: util.cpp
@@ -34,5 +34,7 @@ settings.o: settings.cpp info.h util.h interaction.h
3434
g++ -c -g settings.cpp
3535
factory.o: factory.cpp env.h strategy.h
3636
g++ -c -g factory.cpp
37+
file_system.o: file_system.cpp
38+
g++ -c -g file_system.cpp
3739
clean:
3840
rm *.o

user.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ User::User(const string& userName) : userName(userName) {
44
}
55

66
void User::create() {
7-
8-
//TODO: create directory
7+
8+
makeDir("user/" + userName);
99

1010
string prefix = "./user/" + userName + "/";
1111
ofstream ofs;
1212

1313
ofs.open((prefix + "basic.dat").c_str());
14-
ofs << "*all* {\n@timestamp@0.\n@level@50.\n}";
14+
ofs << "*all* {\n@timestamp@0.\n@level@50.\n@selectstrategy@-1.\n@formstrategy@0.\n}";
1515
ofs.close();
1616
ofs.clear();
1717

user.h

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <fstream>
55
#include "info.h"
66
#include "util.h"
7+
#include "file_system.h"
78

89
class User {
910

user/userlist.dat~

-1
This file was deleted.

0 commit comments

Comments
 (0)