Пример #1
0
func ensureDesktopFileInstalled() {
	dataHome := config.XdgDataHome()
	if dataHome != "" && fileExists(dataHome) {
		os.MkdirAll(filepath.Join(dataHome, "applications"), 0700)
		ioutil.WriteFile(filepath.Join(dataHome, "applications", "coyim.desktop"), []byte(generateDesktopFile(false)), 0600)
		ioutil.WriteFile(filepath.Join(dataHome, "applications", "coyim-debug.desktop"), []byte(generateDesktopFile(true)), 0600)
	}
}
Пример #2
0
func (g *gajimImporter) findFiles() (configFile string, pluginFile string, keyFiles []string, fingerprintFiles []string) {
	var configRoot, dataRoot string

	if config.IsWindows() {
		configRoot = filepath.Join(config.SystemConfigDir(), "Gajim")
		dataRoot = configRoot
	} else {
		configRoot = filepath.Join(config.XdgConfigHome(), "gajim")
		dataRoot = filepath.Join(config.XdgDataHome(), "gajim")
	}

	configFile = filepath.Join(configRoot, "config")
	pluginFile = filepath.Join(configRoot, "pluginsconfig/gotr")

	fingerprintFiles = getFilesMatching(dataRoot, gajimOtrDataFingerprintsExtension)
	keyFiles = getFilesMatching(dataRoot, gajimOtrDataKeyExtension)

	return
}
Пример #3
0
func ensureIconsInstalled() {
	dataHome := config.XdgDataHome()
	if dataHome != "" && fileExists(dataHome) {
		icon16, _ := coyimIcon.createPixBufWithSize(16, 16)
		icon32, _ := coyimIcon.createPixBufWithSize(32, 32)
		icon48, _ := coyimIcon.createPixBufWithSize(48, 48)
		icon128, _ := coyimIcon.createPixBufWithSize(128, 128)
		icon256, _ := coyimIcon.createPixBufWithSize(256, 256)

		os.MkdirAll(filepath.Join(dataHome, "icons/hicolor/16x16/apps"), 0700)
		os.MkdirAll(filepath.Join(dataHome, "icons/hicolor/32x32/apps"), 0700)
		os.MkdirAll(filepath.Join(dataHome, "icons/hicolor/48x48/apps"), 0700)
		os.MkdirAll(filepath.Join(dataHome, "icons/hicolor/128x128/apps"), 0700)
		os.MkdirAll(filepath.Join(dataHome, "icons/hicolor/256x256/apps"), 0700)

		fileName := iconFileName()
		icon16.SavePNG(filepath.Join(dataHome, "icons/hicolor/16x16/apps", fileName), 9)
		icon32.SavePNG(filepath.Join(dataHome, "icons/hicolor/32x32/apps", fileName), 9)
		icon48.SavePNG(filepath.Join(dataHome, "icons/hicolor/48x48/apps", fileName), 9)
		icon128.SavePNG(filepath.Join(dataHome, "icons/hicolor/128x128/apps", fileName), 9)
		icon256.SavePNG(filepath.Join(dataHome, "icons/hicolor/256x256/apps", fileName), 9)
	}
}