Skip to content

Commit

Permalink
fix: following #108
Browse files Browse the repository at this point in the history
close #120
  • Loading branch information
aooohan committed Mar 19, 2024
1 parent 52e7c7b commit 76ca0c2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (m *Manager) Remove(pluginName string) error {
return err
}
source.clearCurrentEnvConfig()
pPath := filepath.Join(m.PathMeta.PluginPath, pluginName+".lua")
pPath := filepath.Join(m.PathMeta.PluginPath, pluginName)
pterm.Printf("Removing %s plugin...\n", pPath)
err = os.RemoveAll(pPath)
if err != nil {
Expand Down Expand Up @@ -262,8 +262,10 @@ func (m *Manager) Add(pluginName, url, alias string) error {
if util.FileExists(destPath) {
return fmt.Errorf("plugin %s already exists", pname)
}
err = os.WriteFile(destPath, []byte(content), 0777)
if err != nil {
if err = os.Mkdir(filepath.Dir(destPath), 0777); err != nil {
return fmt.Errorf("add plugin error: %w", err)
}
if err = os.WriteFile(destPath, []byte(content), 0777); err != nil {
return fmt.Errorf("add plugin error: %w", err)
}
pterm.Println("Plugin info:")
Expand Down

0 comments on commit 76ca0c2

Please sign in to comment.