Exemple #1
0
func CreateDir(dirname string) {
	if Exists(dirname) {
		term.Error("directory '" + dirname + "' already exists")
	} else {
		err := os.Mkdir(dirname, 0755)

		if err != nil {
			term.Error(err.Error())
		} else {
			term.Create(dirname)
		}
	}
}
Exemple #2
0
func CreateFile(filename string) {
	if Exists(filename) {
		term.Error("file '" + filename + "' already exists")
	} else {
		file, err := os.Create(filename)

		if err != nil {
			term.Error(err.Error())
		} else {
			term.Create(filename)
		}

		defer file.Close()
	}
}