@@ -36,7 +36,7 @@ pub enum Package {
36
36
root_path : PathBuf ,
37
37
38
38
/// Add binary file
39
- #[ clap( short, long, num_args( 0 ..) ) ]
39
+ #[ clap( short, long, num_args( 1 ..) ) ]
40
40
binary : Vec < PathBuf > ,
41
41
42
42
/// Location of output file
@@ -333,8 +333,10 @@ fn create_package(
333
333
// Copy headers
334
334
if let Some ( ref api) = mod_file_info. api {
335
335
for header in & api. include {
336
- fs:: copy ( root_path. join ( & header) , working_dir. join ( header) )
337
- . expect ( "Unable to copy headers" ) ;
336
+ let out = working_dir. join ( header. strip_prefix ( & root_path) . unwrap_or ( header) ) ;
337
+ out. parent ( ) . map ( fs:: create_dir_all) ;
338
+ fs:: copy ( root_path. join ( & header) , & out)
339
+ . expect ( & format ! ( "Unable to copy header {} to {}" , header. to_string_lossy( ) , out. display( ) ) ) ;
338
340
}
339
341
}
340
342
@@ -345,8 +347,6 @@ fn create_package(
345
347
binary_name = mod_file_info. id . to_string ( ) + ext;
346
348
}
347
349
348
- println ! ( "name {}" , binary_name) ;
349
-
350
350
std:: fs:: copy ( binary, working_dir. join ( binary_name) )
351
351
. expect ( & format ! ( "Unable to copy binary at '{}'" , binary. display( ) ) ) ;
352
352
}
@@ -538,6 +538,23 @@ fn find_dependency(
538
538
fn setup ( config : & Config , input : PathBuf , output : PathBuf , externals : Vec < String > ) {
539
539
let mod_info = parse_mod_info ( & input) ;
540
540
541
+ // if let Some(ref api) = mod_info.api {
542
+ // // copy headers elsewhere because they are still used by the build tool
543
+ // // when package new
544
+ // let api_dir = output.join(format!("{}.geode_build", mod_info.id));
545
+ // if api_dir.exists() {
546
+ // fs::remove_dir_all(&api_dir).expect("Unable to clear directory for mod headers");
547
+ // }
548
+ // fs::create_dir_all(&api_dir).expect("Unable to create directory for mod headers");
549
+
550
+ // for header in &api.include {
551
+ // let out = api_dir.join(header);
552
+ // out.parent().map(fs::create_dir_all);
553
+ // fs::copy(input.join(&header), out)
554
+ // .expect(&format!("Unable to copy header {}", header.to_string_lossy()));
555
+ // }
556
+ // }
557
+
541
558
// If no dependencies, skippy wippy
542
559
if mod_info. dependencies . is_empty ( ) {
543
560
return ;
@@ -697,7 +714,7 @@ fn setup(config: &Config, input: PathBuf, output: PathBuf, externals: Vec<String
697
714
698
715
let path_to_dep_geode;
699
716
let geode_info;
700
- match ( found_in_index , found_in_installed ) {
717
+ match ( found_in_installed , found_in_index ) {
701
718
( Found :: Some ( inst_path, inst_info) , Found :: Some ( _, _) ) => {
702
719
info ! ( "Dependency '{}' found" , dep. id) ;
703
720
path_to_dep_geode = inst_path;
@@ -754,7 +771,7 @@ fn setup(config: &Config, input: PathBuf, output: PathBuf, externals: Vec<String
754
771
) ;
755
772
path_to_dep_geode = install_mod (
756
773
config, & indx_info. id ,
757
- & VersionReq :: parse ( & format ! ( "== {}" , indx_info. version. to_string( ) ) ) . unwrap ( )
774
+ & VersionReq :: parse ( & format ! ( "={}" , indx_info. version. to_string( ) ) ) . unwrap ( )
758
775
) ;
759
776
geode_info = indx_info;
760
777
}
0 commit comments