@@ -14,7 +14,7 @@ use std::{
14
14
} ,
15
15
io:: { self , Read , Write } ,
16
16
num:: NonZeroU32 ,
17
- path:: Path ,
17
+ path:: { Path , PathBuf } ,
18
18
str,
19
19
sync:: atomic:: AtomicBool ,
20
20
} ;
@@ -109,12 +109,12 @@ struct Runner {
109
109
110
110
impl Runner {
111
111
fn run ( & self ) -> Result < ( ) , Error > {
112
- let project_path = Path :: new ( & self . args . project_path ) ;
112
+ let project_path = PathBuf :: from ( & self . args . project_path ) ;
113
113
self . print
114
114
. infoln ( format ! ( "Initializing project at {project_path:?}" ) ) ;
115
115
116
116
// create a project dir, and copy the contents of the base template (contract-init-template) into it
117
- create_dir_all ( project_path) . map_err ( |e| {
117
+ create_dir_all ( & project_path) . map_err ( |e| {
118
118
self . print
119
119
. errorln ( "Error creating new project directory: {project_path:?}" ) ;
120
120
e
@@ -126,7 +126,7 @@ impl Runner {
126
126
return Ok ( ( ) ) ;
127
127
}
128
128
129
- if !& self . args . frontend_template . is_empty ( ) {
129
+ if !self . args . frontend_template . is_empty ( ) {
130
130
// create a temp dir for the template repo
131
131
let fe_template_dir = tempfile:: tempdir ( ) . map_err ( |e| {
132
132
self . print
@@ -138,7 +138,7 @@ impl Runner {
138
138
self . clone_repo ( & self . args . frontend_template , fe_template_dir. path ( ) ) ?;
139
139
140
140
// copy the frontend template files into the project
141
- self . copy_frontend_files ( fe_template_dir. path ( ) , project_path) ?;
141
+ self . copy_frontend_files ( fe_template_dir. path ( ) , & project_path) ?;
142
142
}
143
143
144
144
// if there are --with-example flags, include the example contracts
@@ -156,7 +156,7 @@ impl Runner {
156
156
// copy the example contracts into the project
157
157
self . copy_example_contracts (
158
158
examples_dir. path ( ) ,
159
- project_path,
159
+ & project_path,
160
160
& self . args . with_example ,
161
161
) ?;
162
162
}
@@ -203,7 +203,8 @@ impl Runner {
203
203
}
204
204
205
205
if exists {
206
- self . print . overln ( format ! ( "Overwriting {to:?}" ) ) ;
206
+ self . print
207
+ . plusln ( format ! ( "Writing {to:?} (overwriting existing file)" ) ) ;
207
208
} else {
208
209
self . print . plusln ( format ! ( "Writing {to:?}" ) ) ;
209
210
}
@@ -260,7 +261,9 @@ impl Runner {
260
261
}
261
262
262
263
if self . args . overwrite && !append {
263
- self . print . overln ( format ! ( "Overwriting {new_path_str}" ) ) ;
264
+ self . print . plusln ( format ! (
265
+ "Writing {new_path_str} (overwriting existing file)"
266
+ ) ) ;
264
267
} else {
265
268
self . print . infoln ( format ! (
266
269
"Skipped creating {new_path_str} as it already exists"
0 commit comments