executing an executable exe now properly executing through wine
This commit is contained in:
+26
-2
@@ -198,10 +198,34 @@ void move_right(){
|
|||||||
|
|
||||||
skip_if_empty_dir
|
skip_if_empty_dir
|
||||||
|
|
||||||
|
char *cmd = NULL;
|
||||||
|
|
||||||
|
|
||||||
if (mid_dir.current_file->file_type & FILE_TYPE_DIR) {
|
if (mid_dir.current_file->file_type & FILE_TYPE_DIR) {
|
||||||
change_dir(mid_dir.current_file->file_name);
|
change_dir(mid_dir.current_file->file_name);
|
||||||
} else if (mid_dir.current_file->file_type & FILE_TYPE_EXEC) {
|
} else if (mid_dir.current_file->file_type & FILE_TYPE_EXEC) {
|
||||||
char *cmd = parse_cmd("./"SETTINGS_COMMAND_REPLACE_STR, mid_dir.current_file->file_name);
|
|
||||||
|
/* if an .exe is executable, this branch will trigger as expected,
|
||||||
|
* however since executing an .exe without wine causes a exec format error, we should check if the program you tried to access is that
|
||||||
|
* if an .exe is not executable, it will get to the top else branch, then hit the comparison in the file extension area, and succeed also.
|
||||||
|
* that is unless the user removed wine out of the file_extension_default_cmd,
|
||||||
|
* in which case im going to assume wine isnt installed anyways as that would require:
|
||||||
|
* a. thought on my end in how to catch wine being removed in the config
|
||||||
|
* b. the user having deliberately changed the default config (good, thats why they are easily configurable)
|
||||||
|
* c. if wine is not installed on the system, executing an .exe would fail regardless of via direct execution or through wine */
|
||||||
|
char *extension = mid_dir.current_file->file_name;
|
||||||
|
while (extension <= mid_dir.current_file->file_name + strlen(mid_dir.current_file->file_name)) {
|
||||||
|
if (*extension == '.') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
extension++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(extension, ".exe") == 0) {
|
||||||
|
cmd = parse_cmd("wine ./"SETTINGS_COMMAND_REPLACE_STR, mid_dir.current_file->file_name);
|
||||||
|
} else {
|
||||||
|
cmd = parse_cmd("./"SETTINGS_COMMAND_REPLACE_STR, mid_dir.current_file->file_name);
|
||||||
|
}
|
||||||
ignore_return(system(cmd));
|
ignore_return(system(cmd));
|
||||||
} else {
|
} else {
|
||||||
char *mime = get_mimetype(mid_dir.current_file);
|
char *mime = get_mimetype(mid_dir.current_file);
|
||||||
@@ -258,8 +282,8 @@ void move_right(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
status &= ~STATUS_MOVE_RIGHT_MATCH;
|
status &= ~STATUS_MOVE_RIGHT_MATCH;
|
||||||
free(cmd);
|
|
||||||
}
|
}
|
||||||
|
free(cmd);
|
||||||
|
|
||||||
status |= (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
|
status |= (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user