func copyDeepinManuals(home, lang string) error { var ( langDesc = map[string]string{ "zh_CN": "用户手册", } langDoc = map[string]string{ "zh_CN": "文档", "zh_TW": "文件", "en_US": "Documents", } ) src := path.Join("/usr/share/doc/deepin-manuals", lang) if !dutils.IsFileExist(src) { return fmt.Errorf("Not found the file or directiry: %v", src) } destName, ok := langDesc[lang] if !ok { return fmt.Errorf("The language '%s' does not support", lang) } docName, ok := langDoc[lang] if !ok { docName = "Documents" } doc := path.Join(home, docName) if !dutils.IsFileExist(doc) { err := os.MkdirAll(doc, 0755) if err != nil { return err } } dest := path.Join(doc, destName) if dutils.IsFileExist(dest) { return nil } return dutils.SymlinkFile(src, dest) }
func copySoundThemeData(home, lang string) error { src := "/usr/share/deepin-sample-music/playlist.m3u" if !dutils.IsFileExist(src) { return fmt.Errorf("Not found the file: %v", src) } dir := path.Join(home, ".sample-music") if !dutils.IsFileExist(dir) { err := os.MkdirAll(dir, 0755) if err != nil { return err } } dest := path.Join(dir, "太歌·四季.m3u") if dutils.IsFileExist(dest) { return nil } return dutils.SymlinkFile(src, dest) }