Commit 9e32be4a authored by Claes Sjofors's avatar Claes Sjofors

Build directory, directory created if it doesn't exist

parent 49e06cc1
...@@ -1687,7 +1687,9 @@ void wb_build::directories( char *dir, bld_ePass pass) ...@@ -1687,7 +1687,9 @@ void wb_build::directories( char *dir, bld_ePass pass)
// Check if file should be updated // Check if file should be updated
int update = 0; int update = 0;
pwr_tFileName source, target; pwr_tFileName source, target;
pwr_tFileName target_dir;
pwr_tTime source_time, target_time; pwr_tTime source_time, target_time;
char *s;
strncpy( source, found_file, sizeof(source)); strncpy( source, found_file, sizeof(source));
strncpy( target, line_item[3], sizeof(target)); strncpy( target, line_item[3], sizeof(target));
...@@ -1714,6 +1716,18 @@ void wb_build::directories( char *dir, bld_ePass pass) ...@@ -1714,6 +1716,18 @@ void wb_build::directories( char *dir, bld_ePass pass)
if ( !opt.force && !update) if ( !opt.force && !update)
continue; continue;
if ( EVEN(sts)) {
// Check that directory exist, create if it doesn't
strcpy( target_dir, target);
if ( (s = strrchr( target_dir, '/'))) {
*s = 0;
sts = dcli_file_time( target_dir, &target_time);
if ( EVEN(sts)) {
sprintf( cmd, "mkdir -p %s", target_dir);
system( cmd);
}
}
}
sprintf( cmd, "cp %s %s", source, target); sprintf( cmd, "cp %s %s", source, target);
system( cmd); system( cmd);
sprintf( cmd, "Build: copy %s %s -> %s", line_item[1], source, target); sprintf( cmd, "Build: copy %s %s -> %s", line_item[1], source, target);
......
...@@ -1195,9 +1195,29 @@ pwr_tStatus WbExpWNav::exp() ...@@ -1195,9 +1195,29 @@ pwr_tStatus WbExpWNav::exp()
printf( "%s\n", cmd); printf( "%s\n", cmd);
sts = system( cmd); sts = system( cmd);
if ( sts != 0) { if ( sts != 0) {
char msg[250]; // Check that directory exist, create if it doesn't
snprintf( msg, sizeof(msg), "Build error %d, %s", WEXITSTATUS(sts), cmd); pwr_tFileName target_dir;
MsgWindow::message( 'E', msg, msgw_ePop_Default); pwr_tTime target_time;
char *s;
strcpy( target_dir, cp->target);
if ( (s = strrchr( target_dir, '/'))) {
*s = 0;
sts = dcli_file_time( target_dir, &target_time);
if ( EVEN(sts)) {
sprintf( cmd, "mkdir -p %s", target_dir);
system( cmd);
sprintf( cmd, "cp %s %s", cp->source, cp->target);
printf( "%s\n", cmd);
sts = system( cmd);
}
}
if ( sts != 0) {
char msg[250];
snprintf( msg, sizeof(msg), "Build error %d, %s", WEXITSTATUS(sts), cmd);
MsgWindow::message( 'E', msg, msgw_ePop_Default);
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment