func (a *CharmArchive) ExpandTo(dir string) error {
	zipr, err := a.zopen.openZip()
	if err != nil {
		return err
	}
	defer zipr.Close()
	if err := ziputil.ExtractAll(zipr.Reader, dir); err != nil {
		return err
	}
	hooksDir := filepath.Join(dir, "hooks")
	fixHook := fixHookFunc(hooksDir, a.meta.Hooks())
	if err := filepath.Walk(hooksDir, fixHook); err != nil {
		if !os.IsNotExist(err) {
			return err
		}
	}
	revFile, err := os.Create(filepath.Join(dir, "revision"))
	if err != nil {
		return err
	}
	if _, err := revFile.Write([]byte(strconv.Itoa(a.revision))); err != nil {
		return err
	}
	if err := revFile.Sync(); err != nil {
		return err
	}
	if err := revFile.Close(); err != nil {
		return err
	}
	return nil
}
// ExpandTo expands the charm archive into dir, creating it if necessary.
// If any errors occur during the expansion procedure, the process will
// abort.
ExpandTo expands the charm archive into dir, creating it if necessary.
If any errors occur during the expansion procedure, the process will
abort.
// ExpandTo expands the charm archive into dir creating it if necessary . // If any errors occur during the expansion procedure the process will // abort .
func (a *CharmArchive) ExpandTo(dir string) error {
	zipr, err := a.zopen.openZip()
	if err != nil {
		return err
	}
	defer zipr.Close()
	if err := ziputil.ExtractAll(zipr.Reader, dir); err != nil {
		return err
	}
	hooksDir := filepath.Join(dir, "hooks")
	fixHook := fixHookFunc(hooksDir, a.meta.Hooks())
	if err := filepath.Walk(hooksDir, fixHook); err != nil {
		if !os.IsNotExist(err) {
			return err
		}
	}
	revFile, err := os.Create(filepath.Join(dir, "revision"))
	if err != nil {
		return err
	}
	if _, err := revFile.Write([]byte(strconv.Itoa(a.revision))); err != nil {
		return err
	}
	if err := revFile.Sync(); err != nil {
		return err
	}
	if err := revFile.Close(); err != nil {
		return err
	}
	return nil
}
func ( a * CharmArchive ) ExpandTo ( dir string ) error { zipr , err := a . zopen . openZip ( ) if err != nil { return err } defer zipr . Close ( ) if err := ziputil . ExtractAll ( zipr . Reader , dir ) ; err != nil { return err } hooksDir := filepath . Join ( dir , " " ) fixHook := fixHookFunc ( hooksDir , a . meta . Hooks ( ) ) if err := filepath . Walk ( hooksDir , fixHook ) ; err != nil { if ! os . IsNotExist ( err ) { return err } } revFile , err := os . Create ( filepath . Join ( dir , " " ) ) if err != nil { return err } if _ , err := revFile . Write ( [ ] byte ( strconv . Itoa ( a . revision ) ) ) ; err != nil { return err } if err := revFile . Sync ( ) ; err != nil { return err } if err := revFile . Close ( ) ; err != nil { return err } return nil }
ExpandTo expands the charm archive into dir, creating it if necessary.
ExpandTo expands the charm archive into dir creating it if necessary .