Subversion Repositories Kolibri OS

Rev

Rev 9376 | Rev 9381 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9376 Rev 9377
Line 49... Line 49...
49
    else:
49
    else:
50
        a = shlex.split(s)
50
        a = shlex.split(s)
51
        return subprocess.Popen(a, bufsize = 0, stdout = qemu_stdout, stderr = qemu_stderr, stdin = subprocess.DEVNULL, start_new_session = True)
51
        return subprocess.Popen(a, bufsize = 0, stdout = qemu_stdout, stderr = qemu_stderr, stdin = subprocess.DEVNULL, start_new_session = True)
Line 52... Line 52...
52
 
52
 
53
if __name__ == "__main__":
53
if __name__ == "__main__":
Line 54... Line 54...
54
    program_files = build()
54
    program_name = build()
Line 55... Line 55...
55
 
55
 
56
    os.makedirs("workspace", exist_ok = True)
56
    os.makedirs("workspace", exist_ok = True)
Line 70... Line 70...
70
    # Remove unuseful folders
70
    # Remove unuseful folders
71
    img.delete_path("GAMES")
71
    img.delete_path("GAMES")
72
    img.delete_path("DEMOS")
72
    img.delete_path("DEMOS")
73
    img.delete_path("3D")
73
    img.delete_path("3D")
Line 74... Line 74...
74
 
74
 
75
    log("Moving program files into kolibri image... ", end = "")
-
 
76
    for file_name in program_files:
75
    log("Moving program into kolibri image... ", end = "")
77
        with open(file_name, "rb") as file:
76
    with open(program_name, "rb") as file:
78
            file_data = file.read()
77
        file_data = file.read()
79
        if not img.add_file_path(file_name.upper(), file_data):
78
    if not img.add_file_path(program_name.upper(), file_data):
80
            print(f"Coudn't move {file_name} into IMG")
79
        print(f"Coudn't move {program_name} into IMG")
Line 81... Line 80...
81
    log("Done")
80
    log("Done")
82
 
81
 
83
    # TODO: Figure out which of compiled files is a program executable and only run it
-
 
84
    log("Adding program to autorun.dat", end = "")
-
 
85
    lines_to_add = b""
82
    # TODO: Figure out which of compiled files is a program executable and only run it
86
    for file_name in program_files:
83
    log("Adding program to autorun.dat... ", end = "")
87
        lines_to_add += bytes(f"\r\n/SYS/{file_name.upper()}\t\t""\t0\t# Your program", "ascii")
84
    lines_to_add = bytes(f"\r\n/SYS/{program_name.upper()}\t\t""\t0\t# Your program", "ascii")
88
    autorun_dat = img.extract_file_path("SETTINGS\AUTORUN.DAT")
85
    autorun_dat = img.extract_file_path("SETTINGS\AUTORUN.DAT")
89
    place_for_new_lines = autorun_dat.index(b"\r\n/SYS/@TASKBAR")# b"\r\n### Hello, ASM World! ###")
86
    place_for_new_lines = autorun_dat.index(b"\r\n/SYS/@TASKBAR")# b"\r\n### Hello, ASM World! ###")
90
    autorun_dat = autorun_dat[:place_for_new_lines] + lines_to_add + autorun_dat[place_for_new_lines:]
87
    autorun_dat = autorun_dat[:place_for_new_lines] + lines_to_add + autorun_dat[place_for_new_lines:]