@@ -31,6 +31,16 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
3131 return InResponse {}, err
3232 }
3333
34+ // if AssetDir is true, create a separate directory for assets
35+ assetDir := destDir
36+ if request .Source .AssetDir {
37+ assetDir = filepath .Join (destDir , "assets" )
38+ err = os .MkdirAll (assetDir , 0755 )
39+ if err != nil {
40+ return InResponse {}, err
41+ }
42+ }
43+
3444 var foundRelease * github.RepositoryRelease
3545 var commitSHA string
3646
@@ -121,7 +131,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
121131 continue
122132 }
123133
124- path := filepath .Join (destDir , * asset .Name )
134+ path := filepath .Join (assetDir , * asset .Name )
125135
126136 var matchFound bool
127137 if len (request .Params .Globs ) == 0 {
@@ -158,7 +168,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
158168 return InResponse {}, err
159169 }
160170 fmt .Fprintln (c .writer , "downloading source tarball to source.tar.gz" )
161- if err := c .downloadFile (u .String (), filepath .Join (destDir , "source.tar.gz" )); err != nil {
171+ if err := c .downloadFile (u .String (), filepath .Join (assetDir , "source.tar.gz" )); err != nil {
162172 return InResponse {}, err
163173 }
164174 }
@@ -169,7 +179,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
169179 return InResponse {}, err
170180 }
171181 fmt .Fprintln (c .writer , "downloading source zip to source.zip" )
172- if err := c .downloadFile (u .String (), filepath .Join (destDir , "source.zip" )); err != nil {
182+ if err := c .downloadFile (u .String (), filepath .Join (assetDir , "source.zip" )); err != nil {
173183 return InResponse {}, err
174184 }
175185 }
0 commit comments