// KeyFilename returns the filename associated with `key`
329885
func (d *Datastore) KeyFilename(key ds.Key) string {
	return filepath.Join(d.path, key.String(), ObjectKeySuffix)
}
354392
func (r *KeyResource) FindName(title string) (*Key, error) {
	keys, err := r.List()
	if err != nil {
		return nil, err
	}

	for _, key := range keys {
		if key.Title == title {
			return key, nil
		}
	}

	return nil, ErrNotFound
}
893826
func AuthKeyFromFile(filename string) (*ecdsa.PrivateKey, error) {
	bytes, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}
	return AuthKeyFromBytes(bytes)
}
904612
func (c *Client) DeleteKey(keyName string) error {
	req := request{
		method:         client.DELETE,
		url:            makeURL(apiKeys, keyName),
		expectedStatus: http.StatusNoContent,
	}
	if _, err := c.sendRequest(req); err != nil {
		return errors.Newf(err, "failed to delete key with name: %s", keyName)
	}
	return nil
}
1301228
func FormatFromFilename(filename string) (Format, error) {
	ext := filepath.Ext(filename)
	return FormatFromExtension(ext)
}
944370
func (c *CloudAPI) DeleteKey(keyName string) error {
	if err := c.ProcessFunctionHook(c, keyName); err != nil {
		return err
	}

	for i, key := range c.keys {
		if key.Name == keyName {
			c.keys = append(c.keys[:i], c.keys[i+1:]...)
			return nil
		}
	}

	return fmt.Errorf("Key %s not found", keyName)
}
127577
func (s *Section) Key(name string) *Key {
	key, err := s.GetKey(name)
	if err != nil {
		// It's OK here because the only possible error is empty key name,
		// but if it's empty, this piece of code won't be executed.
		key, _ = s.NewKey(name, "")
		return key
	}
	return key
}
610790
func (c SimpleFSClient) SimpleFSRename(ctx context.Context, __arg SimpleFSRenameArg) (err error) {
	err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSRename", []interface{}{__arg}, nil)
	return
}
679194
func idFromFileName(name string) (int, error) {
	parts := strings.Split(filepath.Base(name), ".")
	if len(parts) != 2 {
		return 0, fmt.Errorf("file %s has wrong name format to have an id", name)
	}

	id, err := strconv.ParseUint(parts[0][1:], 10, 32)

	return int(id), err
}
758211
func (v *FileChooser) SelectFilename(filename string) bool {
	ptr := C.CString(filename)
	defer cfree(ptr)
	return gobool(C.gtk_file_chooser_select_filename(v.GFileChooser, ptr))
}
636078
func TempKeyFile() (string, error) {
	f, err := ioutil.TempFile("", "zenoss_key.")
	if err != nil {
		return "", err
	}
	defer f.Close()
	fmt.Fprint(f, InsecureKeyPEM)
	return f.Name(), nil
}
491647
func (ev *KeyEvent) Name() string {
	s := ""
	m := []string{}
	if ev.Modifiers&ModShift != 0 {
		m = append(m, "Shift")
	}
	if ev.Modifiers&ModAlt != 0 {
		m = append(m, "Alt")
	}
	if ev.Modifiers&ModMeta != 0 {
		m = append(m, "Meta")
	}
	if ev.Modifiers&ModCtrl != 0 {
		m = append(m, "Ctrl")
	}

	ok := false
	if s, ok = keyNames[ev.Key]; !ok {
		if ev.Key == KeyRune {
			s = string(ev.Rune)
		} else {
			s = "Unknown"
		}
	}
	if len(m) != 0 {
		if ev.Modifiers&ModCtrl != 0 && strings.HasPrefix(s, "Ctrl-") {
			s = s[5:]
		}
		return fmt.Sprintf("%s+%s", strings.Join(m, "+"), s)
	}
	return s
}
769700
func readKey(filename, pathFormat string) ([keySize]byte, error) {
	var data32 [keySize]byte

	// read the data back
	data, err := readFile(fmt.Sprintf(pathFormat, filename))
	if err != nil {
		return data32, err
	}
	// decode from hex
	dst := make([]byte, len(data))
	_, err = hex.Decode(dst, data) //.StdEncoding.Decode(dst, data)
	if err != nil {
		return data32, err
	}
	// fill in the 32 byte array witht he data and return it
	copy(data32[:], dst[:keySize])
	return data32, err
}
398376
func eventsFileName(dataDir string, sessionID session.ID, eventIndex int64) string {
	return filepath.Join(dataDir, fmt.Sprintf("%v-%v.events.gz", sessionID.String(), eventIndex))
}
916152
func (f *File) RemoveKey(key string) {
	name, k := f.NameSplitFunc(key)

	// get the section
	section := f.GetSection(name)
	if section == nil {
		return
	}

	section.RemoveKey(k)
}
116120
func GetKeyName(key Key, scancode int) string {
	ret := C.glfwGetKeyName(C.int(key), C.int(scancode))
	panicError()
	return C.GoString(ret)
}
212186
func (b Base) GetFileName() string {
	if b.FileName != "" {
		return b.FileName
	}
	if b.Url != "" {
		return filepath.Base(b.Url)
	}
	return ""
}