|
|
|
@ -12,7 +12,7 @@ import ( |
|
|
|
// 启动web服务
|
|
|
|
func startWeb() { |
|
|
|
//创建一个文件服务器,会去www目录下找index.html
|
|
|
|
fileServer := http.FileServer(http.Dir("./fsw")) |
|
|
|
fileServer := http.FileServer(http.Dir("./www")) |
|
|
|
// 将 "/" 路径映射到文件服务器
|
|
|
|
http.Handle("/", fileServer) |
|
|
|
//扫描指定的目录
|
|
|
|
@ -61,8 +61,8 @@ func main() { |
|
|
|
if args == nil || len(args) < 2 { |
|
|
|
// 编程客户端
|
|
|
|
fmt.Printf("run as client\n") |
|
|
|
|
|
|
|
fmt.Printf("Usage: ./fss -t /home/\n") |
|
|
|
startWeb() |
|
|
|
// 提示
|
|
|
|
os.Exit(1) |
|
|
|
} |
|
|
|
config.G.LocalIP = lcip |
|
|
|
@ -81,6 +81,11 @@ func main() { |
|
|
|
// current work directory
|
|
|
|
config.G.FilePath = curdir |
|
|
|
} |
|
|
|
// 使用帮助
|
|
|
|
if flag == "-h" { |
|
|
|
fmt.Printf("Usage: ./fss -t /home/\n") |
|
|
|
os.Exit(1) |
|
|
|
} |
|
|
|
|
|
|
|
// args 长度大于4 才有意思
|
|
|
|
if len(args) > 4 { |
|
|
|
|