mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
22 lines
305 B
Go
22 lines
305 B
Go
|
package osutil
|
||
|
|
||
|
import "os"
|
||
|
|
||
|
// RootNames returns the result of /*.
|
||
|
func RootNames() []string {
|
||
|
f, err := os.Open("/")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
names, err := f.Readdirnames(-1)
|
||
|
f.Close()
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
for i, name := range names {
|
||
|
names[i] = "/" + name
|
||
|
}
|
||
|
return names
|
||
|
}
|