Skip to content

Commit

Permalink
builder init location fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Aug 11, 2024
1 parent 22ffbae commit f7ae73b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
26 changes: 13 additions & 13 deletions src/ccode/archive-extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@ static void archive_extract_fn(archive *data, char *path, bool all) {
continue;
}
}else if (S_ISREG(mode)){
FILE *file = fopen(target_file, "wb");
if (file == NULL) {
char* error_msg = build_string("Failed to open file for writing: %s", target_file);
error_add(error_msg);
error(3);
}
char buffer[4096];
ssize_t size;
while ((size = archive_read_data(data->archive, buffer, sizeof(buffer))) > 0) {
fwrite(buffer, 1, size, file);
}
fclose(file);
chmod(target_file, 0755);
FILE *file = fopen(target_file, "wb");
if (file == NULL) {
char* error_msg = build_string("Failed to open file for writing: %s", target_file);
error_add(error_msg);
error(3);
}
char buffer[4096];
ssize_t size;
while ((size = archive_read_data(data->archive, buffer, sizeof(buffer))) > 0) {
fwrite(buffer, 1, size, file);
}
fclose(file);
chmod(target_file, 0755);
} else {
fwarning("Skip unsupported archive entry: %s", entry_path);
}
Expand Down
5 changes: 0 additions & 5 deletions src/operations/package-manager/build.vala
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
private bool no_src = false;
private static bool builder_init = false;
private static int build_operation (string[] args) {
if(!builder_init){
builder_ctx_init();
builder_init = true;
}
string current_directory=pwd ();
string[] new_args = args;
if (new_args.length == 0) {
Expand Down
1 change: 1 addition & 0 deletions src/operations/utility/extract.vala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ private static int extract_main (string[] args) {
}
return 0;
}
tar.set_target(pwd());
if (args.length > 1) {
foreach (string file in args[1:]) {
tar.extract (file);
Expand Down
5 changes: 5 additions & 0 deletions src/util/build.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ public void add_build_target(build_target bt) {
bts += bt;
}

private bool builder_init = false;
public class builder {

public builder() {
if(!builder_init){
builder_ctx_init();
builder_init = true;
}
ymp_build = new ympbuild();
string target = get_value("build:target");
if (target == "") {
Expand Down

0 comments on commit f7ae73b

Please sign in to comment.