1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[syslinux] download c32 files in the same directory as the app

* Rufus was downloading c32 files in the last directory browsed, which
  meant that the same file may have had to be downloaded more than once
* Closes #154
This commit is contained in:
Pete Batard 2013-07-02 00:45:47 +01:00
parent 91f2cbafe9
commit 9925cc945d
4 changed files with 21 additions and 10 deletions

View file

@ -616,6 +616,15 @@ out:
return ret;
}
static __inline int _chdirU(const char *dirname)
{
int ret;
wconvert(dirname);
ret = _wchdir(wdirname);
wfree(dirname);
return ret;
}
static __inline FILE* fopenU(const char* filename, const char* mode)
{
FILE* ret = NULL;

View file

@ -324,7 +324,7 @@ BOOL DownloadFile(const char* url, const char* file, HWND hProgressDialog)
}
uprintf("File length: %d bytes\n", dwTotalSize);
fd = fopen(file, "wb");
fd = fopenU(file, "wb");
if (fd == NULL) {
uprintf("Unable to create file '%s': %s\n", file, WinInetErrorString());
goto out;

View file

@ -1043,6 +1043,7 @@ DWORD WINAPI ISOScanThread(LPVOID param)
safe_free(iso_path);
SetMBRProps();
} else if (!iso_report.has_syslinux_v5) { // This check is for Syslinux v4.x or earlier
_chdirU(app_dir);
for (i=0; i<NB_OLD_C32; i++) {
if (iso_report.has_old_c32[i]) {
fd = fopen(old_c32_name[i], "rb");
@ -1054,9 +1055,9 @@ DWORD WINAPI ISOScanThread(LPVOID param)
} else {
PrintStatus(0, FALSE, "Obsolete %s detected", old_c32_name[i]);
safe_sprintf(msgbox, sizeof(msgbox), "This ISO image seems to use an obsolete version of '%s'.\n"
"Because of this, boot menus may not display properly.\n\n"
APPLICATION_NAME " can fix this issue by downloading a newer version for you:\n"
"- Choose 'Yes' to connect to the internet and replace the file\n"
"Boot menus may not may not display properly because of this.\n\n"
"A newer version can be downloaded by " APPLICATION_NAME " to fix this issue:\n"
"- Choose 'Yes' to connect to the internet and download the file\n"
"- Choose 'No' to leave the existing ISO file unmodified\n"
"If you don't know what to do, you should select 'Yes'.\n\n"
"Note: The new file will be downloaded in the current directory and once a "
@ -1238,6 +1239,7 @@ static BOOL BootCheck(void)
return FALSE;
}
} else if (dt == DT_SYSLINUX_V5) {
_chdirU(app_dir);
fd = fopen(ldlinux_c32, "rb");
if (fd != NULL) {
uprintf("Will reuse '%s' for Syslinux v5\n", ldlinux_c32);
@ -1249,7 +1251,7 @@ static BOOL BootCheck(void)
"it is not embedded in " APPLICATION_NAME ".\n\n"
APPLICATION_NAME " can download the missing file for you:\n"
"- Select 'Yes' to connect to the internet and download the file\n"
"- Select 'No' if you will manually copy this file on the drive later\n\n"
"- Select 'No' if you want to manually copy this file on the drive later\n\n"
"Note: The file will be downloaded in the current directory and once a "
"'%s' exists there, it will be reused automatically.\n", ldlinux_c32, ldlinux_c32);
safe_sprintf(msgbox_title, sizeof(msgbox_title), "Download %s?", ldlinux_c32);

View file

@ -30,7 +30,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.3.4.262"
CAPTION "Rufus v1.3.4.263"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -278,8 +278,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,4,262
PRODUCTVERSION 1,3,4,262
FILEVERSION 1,3,4,263
PRODUCTVERSION 1,3,4,263
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -296,13 +296,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.3.4.262"
VALUE "FileVersion", "1.3.4.263"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.3.4.262"
VALUE "ProductVersion", "1.3.4.263"
END
END
BLOCK "VarFileInfo"