From 4e0ce898672abf4be9c9fee2dc8051ea55e8b57e Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Thu, 12 Jul 2018 21:25:15 +0300 Subject: [PATCH] Path update, only resolve shortcuts when resolving path for use. Do not resolve symbolic links/shortcuts when saving config. --- akiko.cpp | 2 +- arcadia.cpp | 8 +++---- audio.cpp | 2 +- blkdev.cpp | 2 +- blkdev_cdimage.cpp | 2 +- cdtv.cpp | 6 +++--- cdtvcr.cpp | 2 +- cfgfile.cpp | 44 ++++++++++++++++++++++++++------------- cia.cpp | 4 ++-- disk.cpp | 2 +- filesys.cpp | 18 ++++++++-------- hardfile.cpp | 4 ++-- include/fsdb.h | 2 +- include/options.h | 6 ++++-- od-win32/fsdb_mywin32.cpp | 14 +++++++------ od-win32/fsdb_win32.cpp | 2 +- od-win32/win32gui.cpp | 2 +- scsitape.cpp | 2 +- x86.cpp | 2 +- 19 files changed, 72 insertions(+), 54 deletions(-) diff --git a/akiko.cpp b/akiko.cpp index d916c76d..c03211a9 100644 --- a/akiko.cpp +++ b/akiko.cpp @@ -87,7 +87,7 @@ static void nvram_read (void) cubo_nvram = cd32_nvram + currprefs.cs_cd32nvram_size; } TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); cd32_flashfile = zfile_fopen (path, _T("rb+"), ZFD_NORMAL); if (!cd32_flashfile) cd32_flashfile = zfile_fopen (path, _T("wb"), 0); diff --git a/arcadia.cpp b/arcadia.cpp index 82cff02a..5437820a 100644 --- a/arcadia.cpp +++ b/arcadia.cpp @@ -450,7 +450,7 @@ int is_arcadia_rom (const TCHAR *path) static void nvram_write (void) { TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); struct zfile *f = zfile_fopen (path, _T("rb+"), ZFD_NORMAL); if (!f) { f = zfile_fopen (path, _T("wb"), 0); @@ -466,7 +466,7 @@ static void nvram_read (void) struct zfile *f; TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); f = zfile_fopen (path, _T("rb"), ZFD_NORMAL); memset (arbmemory + nvram_offset, 0, NVRAM_SIZE); if (!f) @@ -600,7 +600,7 @@ static int algmemory_initialized; static void alg_nvram_write (void) { TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); struct zfile *f = zfile_fopen (path, _T("rb+"), ZFD_NORMAL); if (!f) { f = zfile_fopen (path, _T("wb"), 0); @@ -616,7 +616,7 @@ static void alg_nvram_read (void) struct zfile *f; TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); f = zfile_fopen (path, _T("rb"), ZFD_NORMAL); memset (algmemory, 0, ALG_NVRAM_SIZE); if (!f) diff --git a/audio.cpp b/audio.cpp index e700e602..8f737cdc 100644 --- a/audio.cpp +++ b/audio.cpp @@ -242,7 +242,7 @@ void audio_sampleripper (int mode) if (!name[0]) underline[0] = 0; if (type >= 0) - cfgfile_resolve_path(name, sizeof(name) / sizeof(TCHAR), type); + cfgfile_resolve_path_load(name, sizeof(name) / sizeof(TCHAR), type); namesplit (name); _tcscpy (extension, _T("wav")); _stprintf (filename, _T("%s%s%s%03d.%s"), path, name, underline, cnt, extension); diff --git a/blkdev.cpp b/blkdev.cpp index 6c8d0e79..d76c7a0f 100644 --- a/blkdev.cpp +++ b/blkdev.cpp @@ -418,7 +418,7 @@ static void cd_statusline_label(int unitnum) if (p[0]) { TCHAR name[MAX_DPATH]; struct device_info di; - cfgfile_resolve_path_out(p, name, sizeof(name) / sizeof(TCHAR), PATH_CD); + cfgfile_resolve_path_out_load(p, name, sizeof(name) / sizeof(TCHAR), PATH_CD); const TCHAR *fname = my_getfilepart(name); if (sys_command_info(unitnum, &di, 0) && di.volume_id[0]) statusline_add_message(STATUSTYPE_CD, _T("CD%d: [%s] %s"), unitnum, di.volume_id, fname); diff --git a/blkdev_cdimage.cpp b/blkdev_cdimage.cpp index ae5a62e6..fd4dba16 100644 --- a/blkdev_cdimage.cpp +++ b/blkdev_cdimage.cpp @@ -2233,7 +2233,7 @@ static int open_device (int unitnum, const TCHAR *ident, int flags) cdu->imgname_in[0] = 0; if (ident) { _tcscpy(cdu->imgname_in, ident); - cfgfile_resolve_path_out(cdu->imgname_in, cdu->imgname_out, MAX_DPATH, PATH_CD); + cfgfile_resolve_path_out_load(cdu->imgname_in, cdu->imgname_out, MAX_DPATH, PATH_CD); } parse_image (cdu, ident); cdu->open = true; diff --git a/cdtv.cpp b/cdtv.cpp index a4f03894..f019aa86 100644 --- a/cdtv.cpp +++ b/cdtv.cpp @@ -1543,7 +1543,7 @@ static void cdtv_loadcardmem (uae_u8 *p, int size) if (!size) return; memset (p, 0, size); - cfgfile_resolve_path_out(currprefs.flashfile, flashfilepath, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, flashfilepath, MAX_DPATH, PATH_ROM); f = zfile_fopen (flashfilepath, _T("rb"), ZFD_NORMAL); if (!f) return; @@ -1558,7 +1558,7 @@ static void cdtv_savecardmem (uae_u8 *p, int size) if (!size) return; - cfgfile_resolve_path_out(currprefs.flashfile, flashfilepath, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, flashfilepath, MAX_DPATH, PATH_ROM); f = zfile_fopen (flashfilepath, _T("rb+"), ZFD_NORMAL); if (!f) return; @@ -1573,7 +1573,7 @@ static void cdtv_battram_reset (void) int v; memset (cdtv_battram, 0, CDTV_NVRAM_SIZE); - cfgfile_resolve_path_out(currprefs.flashfile, flashfilepath, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, flashfilepath, MAX_DPATH, PATH_ROM); f = zfile_fopen (flashfilepath, _T("rb+"), ZFD_NORMAL); if (!f) { f = zfile_fopen (flashfilepath, _T("wb"), 0); diff --git a/cdtvcr.cpp b/cdtvcr.cpp index 5d91be72..22d3aff0 100644 --- a/cdtvcr.cpp +++ b/cdtvcr.cpp @@ -110,7 +110,7 @@ static void cdtvcr_battram_reset (void) int v; memset (cdtvcr_ram, 0, CDTVCR_RAM_SIZE); - cfgfile_resolve_path_out(currprefs.flashfile, flashfilepath, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, flashfilepath, MAX_DPATH, PATH_ROM); f = zfile_fopen (flashfilepath, _T("rb+"), ZFD_NORMAL); if (!f) { f = zfile_fopen (flashfilepath, _T("wb"), 0); diff --git a/cfgfile.cpp b/cfgfile.cpp index 651d8fe6..e3c4520a 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -916,12 +916,12 @@ static void cfgfile_write_rom (struct zfile *f, struct multipath *mp, const TCHA } -static void cfgfile_to_path(const TCHAR *in, TCHAR *out, int type) +static void cfgfile_to_path_save(const TCHAR *in, TCHAR *out, int type) { if (_tcschr(in, '%')) { _tcscpy(out, in); } else { - cfgfile_resolve_path_out(in, out, MAX_DPATH, type); + cfgfile_resolve_path_out_save(in, out, MAX_DPATH, type); } } @@ -931,7 +931,7 @@ static void cfgfile_write_path2(struct zfile *f, const TCHAR *option, const TCHA cfgfile_write_str(f, option, value); } else { TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(value, path, MAX_DPATH, type); + cfgfile_resolve_path_out_save(value, path, MAX_DPATH, type); cfgfile_write_str(f, option, path); } } @@ -941,7 +941,7 @@ static void cfgfile_dwrite_path2(struct zfile *f, const TCHAR *option, const TCH cfgfile_dwrite_str(f, option, value); } else { TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(value, path, MAX_DPATH, type); + cfgfile_resolve_path_out_save(value, path, MAX_DPATH, type); cfgfile_dwrite_str(f, option, path); } } @@ -1007,7 +1007,7 @@ static void cfgfile_adjust_path(TCHAR *path, int maxsz, struct multipath *mp) xfree(s); } -void cfgfile_resolve_path_out(const TCHAR *path, TCHAR *out, int size, int type) +static void cfgfile_resolve_path_out_all(const TCHAR *path, TCHAR *out, int size, int type, bool save) { struct uae_prefs *p = &currprefs; TCHAR *s = NULL; @@ -1037,12 +1037,26 @@ void cfgfile_resolve_path_out(const TCHAR *path, TCHAR *out, int size, int type) _tcscpy(out, s); xfree(s); } - my_resolvesoftlink(out, size); + if (!save) { + my_resolvesoftlink(out, size, true); + } } -void cfgfile_resolve_path(TCHAR *path, int size, int type) +void cfgfile_resolve_path_out_load(const TCHAR *path, TCHAR *out, int size, int type) +{ + cfgfile_resolve_path_out_all(path, out, size, type, false); +} +void cfgfile_resolve_path_load(TCHAR *path, int size, int type) +{ + cfgfile_resolve_path_out_all(path, path, size, type, false); +} +void cfgfile_resolve_path_out_save(const TCHAR *path, TCHAR *out, int size, int type) +{ + cfgfile_resolve_path_out_all(path, out, size, type, true); +} +void cfgfile_resolve_path_save(TCHAR *path, int size, int type) { - cfgfile_resolve_path_out(path, path, size, type); + cfgfile_resolve_path_out_all(path, path, size, type, true); } @@ -1071,7 +1085,7 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f) *ptr = 0; } } else { - cfgfile_to_path(ci->rootdir, str1, ci->type == UAEDEV_DIR ? PATH_DIR : (ci->type == UAEDEV_CD ? PATH_CD : (ci->type == UAEDEV_HDF ? PATH_HDF : PATH_TAPE))); + cfgfile_to_path_save(ci->rootdir, str1, ci->type == UAEDEV_DIR ? PATH_DIR : (ci->type == UAEDEV_CD ? PATH_CD : (ci->type == UAEDEV_HDF ? PATH_HDF : PATH_TAPE))); } int ct = ci->controller_type; int romtype = 0; @@ -1119,7 +1133,7 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f) #endif } else if (ci->type == UAEDEV_HDF || ci->type == UAEDEV_CD || ci->type == UAEDEV_TAPE) { TCHAR filesyspath[MAX_DPATH]; - cfgfile_to_path(ci->filesys, filesyspath, PATH_HDF); + cfgfile_to_path_save(ci->filesys, filesyspath, PATH_HDF); TCHAR *sfilesys = cfgfile_escape_min(filesyspath); TCHAR *sgeometry = cfgfile_escape(ci->geometry, NULL, true); _stprintf (tmp, _T("%s,%s:%s,%d,%d,%d,%d,%d,%s,%s"), @@ -1755,7 +1769,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) if (p->cdslots[i].name[0] || p->cdslots[i].inuse) { TCHAR tmp2[MAX_DPATH]; _stprintf (tmp, _T("cdimage%d"), i); - cfgfile_to_path(p->cdslots[i].name, tmp2, PATH_CD); + cfgfile_to_path_save(p->cdslots[i].name, tmp2, PATH_CD); if (p->cdslots[i].type != SCSI_UNIT_DEFAULT || _tcschr (p->cdslots[i].name, ',') || p->cdslots[i].delayed) { _tcscat (tmp2, _T(",")); if (p->cdslots[i].delayed) { @@ -4324,7 +4338,7 @@ static bool parse_geo (const TCHAR *tname, struct uaedev_config_info *uci, struc bool ret = false; TCHAR tgname[MAX_DPATH]; - cfgfile_resolve_path_out(tname, tgname, MAX_DPATH, PATH_HDF); + cfgfile_resolve_path_out_load(tname, tgname, MAX_DPATH, PATH_HDF); ini = ini_load(tgname); if (!ini) return ret; @@ -6288,7 +6302,7 @@ static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, bool real cfgfile_string (line1b, line2b, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof (TCHAR)); // boxart checks cfgfile_string(line1b, line2b, _T("floppy0"), p->floppyslots[0].df, sizeof p->floppyslots[0].df / sizeof(TCHAR)); - cfgfile_resolve_path(p->floppyslots[0].df, MAX_DPATH, PATH_FLOPPY); + cfgfile_resolve_path_load(p->floppyslots[0].df, MAX_DPATH, PATH_FLOPPY); TCHAR tmp[MAX_DPATH]; if (!p->mountitems && (cfgfile_string(line1b, line2b, _T("hardfile2"), tmp, sizeof tmp / sizeof(TCHAR)) || cfgfile_string(line1b, line2b, _T("filesystem2"), tmp, sizeof tmp / sizeof(TCHAR)))) { const TCHAR *s = _tcschr(tmp, ':'); @@ -6310,7 +6324,7 @@ static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, bool real if (se) { tmp[se - tmp] = 0; _tcscpy(p->mountconfig[0].ci.rootdir, s); - cfgfile_resolve_path(p->mountconfig[0].ci.rootdir, MAX_DPATH, isvsys ? PATH_DIR : PATH_HDF); + cfgfile_resolve_path_load(p->mountconfig[0].ci.rootdir, MAX_DPATH, isvsys ? PATH_DIR : PATH_HDF); p->mountitems = 1; } } @@ -6329,7 +6343,7 @@ static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, bool real tmp[se - tmp] = 0; } _tcscpy(p->cdslots[0].name, s); - cfgfile_resolve_path(p->cdslots[0].name, MAX_DPATH, PATH_CD); + cfgfile_resolve_path_load(p->cdslots[0].name, MAX_DPATH, PATH_CD); p->cdslots[0].inuse = 1; } } diff --git a/cia.cpp b/cia.cpp index fff9d29f..57caa61e 100644 --- a/cia.cpp +++ b/cia.cpp @@ -2174,7 +2174,7 @@ static void write_battclock (void) if (!currprefs.rtcfile[0] || currprefs.cs_rtc == 0) return; TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(currprefs.rtcfile, path, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.rtcfile, path, MAX_DPATH, PATH_ROM); struct zfile *f = zfile_fopen (path, _T("wb")); if (f) { struct tm *ct; @@ -2231,7 +2231,7 @@ void rtc_hardreset (void) } if (currprefs.rtcfile[0]) { TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(currprefs.rtcfile, path, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.rtcfile, path, MAX_DPATH, PATH_ROM); struct zfile *f = zfile_fopen (path, _T("rb")); if (f) { uae_u8 empty[13]; diff --git a/disk.cpp b/disk.cpp index 88ed715f..8a2373f0 100644 --- a/disk.cpp +++ b/disk.cpp @@ -770,7 +770,7 @@ int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname_in, TCHAR *o if (wrprot) *wrprot = p->floppy_read_only ? 1 : 0; - cfgfile_resolve_path_out(fname_in, outname, MAX_DPATH, PATH_FLOPPY); + cfgfile_resolve_path_out_load(fname_in, outname, MAX_DPATH, PATH_FLOPPY); if (outfname) _tcscpy(outfname, outname); diff --git a/filesys.cpp b/filesys.cpp index 6296ffdd..75b16923 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -334,7 +334,7 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo * if (!ui) { ui = &uitmp; if (uci->ci.type == UAEDEV_DIR) { - cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_DIR); + cfgfile_resolve_path_out_load(uci->ci.rootdir, filepath, MAX_DPATH, PATH_DIR); _tcscpy(mi->rootdir, filepath); mi->ismounted = 1; if (filepath[0] == 0) @@ -348,7 +348,7 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo * mi->ismedia = true; return FILESYS_VIRTUAL; } else if (uci->ci.type == UAEDEV_HDF) { - cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_HDF); + cfgfile_resolve_path_out_load(uci->ci.rootdir, filepath, MAX_DPATH, PATH_HDF); _tcscpy(mi->rootdir, filepath); ui->hf.ci.readonly = true; ui->hf.ci.blocksize = uci->ci.blocksize; @@ -369,7 +369,7 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo * mi->ismedia = 0; hdf_close (&ui->hf); } else if (uci->ci.type == UAEDEV_CD) { - cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_CD); + cfgfile_resolve_path_out_load(uci->ci.rootdir, filepath, MAX_DPATH, PATH_CD); _tcscpy(mi->rootdir, filepath); struct device_info di; ui->hf.ci.readonly = true; @@ -397,7 +397,7 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo * } } if (uci->ci.type == UAEDEV_TAPE) { - cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_TAPE); + cfgfile_resolve_path_out_load(uci->ci.rootdir, filepath, MAX_DPATH, PATH_TAPE); _tcscpy(mi->rootdir, filepath); struct device_info di; int unitnum = getuindex (p, index); @@ -506,7 +506,7 @@ TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, struct TCHAR *p = NULL; TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(rootdir, path, MAX_DPATH, PATH_DIR); + cfgfile_resolve_path_out_load(rootdir, path, MAX_DPATH, PATH_DIR); archivehd = -1; if (my_existsfile (path)) @@ -701,7 +701,7 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci, bool custo iscd = nr >= cd_unit_offset && nr < cd_unit_offset + cd_unit_number; if (!custom) - cfgfile_resolve_path(c.rootdir, MAX_DPATH, iscd ? PATH_CD : (ci->volname[0] ? PATH_DIR : PATH_HDF)); + cfgfile_resolve_path_load(c.rootdir, MAX_DPATH, iscd ? PATH_CD : (ci->volname[0] ? PATH_DIR : PATH_HDF)); for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { if (nr == i || !mountinfo.ui[i].open || mountinfo.ui[i].rootdir == NULL || is_hardfile (i) == FILESYS_CD) @@ -2747,7 +2747,7 @@ static int fill_file_attrs (Unit *u, a_inode *base, a_inode *c) static int test_softlink (a_inode *aino) { int err; - if (aino->softlink && my_resolvesoftlink (aino->nname, -1)) + if (aino->softlink && my_resolvesoftlink (aino->nname, -1, false)) err = ERROR_IS_SOFT_LINK; else err = ERROR_OBJECT_NOT_AROUND; @@ -3915,7 +3915,7 @@ static void action_read_link(TrapContext *ctx, Unit *unit, dpacket *packet) } _tcscpy (tmp, a->nname); write_log (_T("Resolving softlink '%s'\n"), tmp); - if (!my_resolvesoftlink (tmp, sizeof tmp / sizeof (TCHAR))) { + if (!my_resolvesoftlink (tmp, sizeof tmp / sizeof (TCHAR), false)) { xfree(extrapath); PUT_PCK_RES1 (packet, DOS_FALSE); // not sure what to return @@ -8641,7 +8641,7 @@ static int dofakefilesys (TrapContext *ctx, UnitInfo *uip, uaecptr parmpacket, s tmp[0] = 0; if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) { - cfgfile_resolve_path_out(uip->filesysdir, tmp, MAX_DPATH, PATH_HDF); + cfgfile_resolve_path_out_load(uip->filesysdir, tmp, MAX_DPATH, PATH_HDF); } else if ((dostype & 0xffffff00) == DISK_TYPE_DOS) { _tcscpy (tmp, currprefs.romfile); int i = _tcslen (tmp); diff --git a/hardfile.cpp b/hardfile.cpp index f6955007..49c0300a 100644 --- a/hardfile.cpp +++ b/hardfile.cpp @@ -386,7 +386,7 @@ static void create_virtual_rdb (struct hardfiledata *hfd) if (hfd->ci.filesys[0]) { struct zfile *f = NULL; TCHAR fspath[MAX_DPATH]; - cfgfile_resolve_path_out(hfd->ci.filesys, fspath, MAX_DPATH, PATH_HDF); + cfgfile_resolve_path_out_load(hfd->ci.filesys, fspath, MAX_DPATH, PATH_HDF); filesys = zfile_load_file(fspath, &filesyslen); if (filesys) { fsver = get_filesys_version(filesys, filesyslen); @@ -626,7 +626,7 @@ int hdf_open (struct hardfiledata *hfd, const TCHAR *pname) hfd->virtual_rdb = NULL; if (!pname) pname = hfd->ci.rootdir; - cfgfile_resolve_path_out(pname, filepath, MAX_DPATH, PATH_HDF); + cfgfile_resolve_path_out_load(pname, filepath, MAX_DPATH, PATH_HDF); #ifdef WITH_CHD TCHAR nametmp[MAX_DPATH]; _tcscpy (nametmp, filepath); diff --git a/include/fsdb.h b/include/fsdb.h index 9ab37d6e..a2797aec 100644 --- a/include/fsdb.h +++ b/include/fsdb.h @@ -176,7 +176,7 @@ extern bool my_utime (const TCHAR *name, struct mytimeval *tv); extern bool my_chmod (const TCHAR *name, uae_u32 mode); extern bool my_resolveshortcut(TCHAR *linkfile, int size); extern bool my_resolvessymboliclink(TCHAR *linkfile, int size); -extern bool my_resolvesoftlink(TCHAR *linkfile, int size); +extern bool my_resolvesoftlink(TCHAR *linkfile, int size, bool linkonly); extern const TCHAR *my_getfilepart(const TCHAR *filename); extern void my_canonicalize_path(const TCHAR *path, TCHAR *out, int size); extern int my_issamevolume(const TCHAR *path1, const TCHAR *path2, TCHAR *path); diff --git a/include/options.h b/include/options.h index 3a9b336f..befb22c6 100644 --- a/include/options.h +++ b/include/options.h @@ -913,8 +913,10 @@ extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type extern int target_get_display (const TCHAR*); extern const TCHAR *target_get_display_name (int, bool); extern void target_multipath_modified(struct uae_prefs *); -extern void cfgfile_resolve_path_out(const TCHAR *path, TCHAR *out, int size, int type); -extern void cfgfile_resolve_path(TCHAR *path, int size, int type); +extern void cfgfile_resolve_path_out_load(const TCHAR *path, TCHAR *out, int size, int type); +extern void cfgfile_resolve_path_load(TCHAR *path, int size, int type); +extern void cfgfile_resolve_path_out_save(const TCHAR *path, TCHAR *out, int size, int type); +extern void cfgfile_resolve_path_save(TCHAR *path, int size, int type); extern struct uae_prefs *cfgfile_open(const TCHAR *filename, int *type); extern void cfgfile_close(struct uae_prefs *p); diff --git a/od-win32/fsdb_mywin32.cpp b/od-win32/fsdb_mywin32.cpp index b1b02c7a..c96c68b2 100644 --- a/od-win32/fsdb_mywin32.cpp +++ b/od-win32/fsdb_mywin32.cpp @@ -1003,13 +1003,15 @@ bool my_createshortcut(const TCHAR *source, const TCHAR *target, const TCHAR *de } -bool my_resolvesoftlink(TCHAR *linkfile, int size) +bool my_resolvesoftlink(TCHAR *linkfile, int size, bool linkonly) { - int v = my_resolvessymboliclink2(linkfile, size); - if (v > 0) - return true; - if (v == 0) - return false; + if (!linkonly) { + int v = my_resolvessymboliclink2(linkfile, size); + if (v > 0) + return true; + if (v == 0) + return false; + } if (my_resolveshortcut(linkfile,size)) return true; return false; diff --git a/od-win32/fsdb_win32.cpp b/od-win32/fsdb_win32.cpp index 634a6d0c..407011fe 100644 --- a/od-win32/fsdb_win32.cpp +++ b/od-win32/fsdb_win32.cpp @@ -435,7 +435,7 @@ int fsdb_fill_file_attrs (a_inode *base, a_inode *aino) if (ext && !_tcsicmp (ext, _T(".lnk"))) { TCHAR tmp[MAX_DPATH]; _tcscpy (tmp, aino->nname); - if (my_resolvesoftlink (tmp, sizeof tmp / sizeof (TCHAR))) { + if (my_resolvesoftlink (tmp, sizeof tmp / sizeof (TCHAR), false)) { //write_log (_T("2 '%s'\n"), aino->nname); ext = _tcsrchr (aino->aname, '.'); if (ext && !_tcsicmp (ext, _T(".lnk"))) diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 64124ff0..e7378ae8 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -20059,7 +20059,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) int mask; DragQueryFile (hd, i, file, sizeof (file) / sizeof (TCHAR)); - my_resolvesoftlink (file, sizeof file / sizeof (TCHAR)); + my_resolvesoftlink (file, sizeof file / sizeof (TCHAR), true); filepart = _tcsrchr (file, '/'); if (!filepart) filepart = _tcsrchr (file, '\\'); diff --git a/scsitape.cpp b/scsitape.cpp index 21c7b36e..839a4d06 100644 --- a/scsitape.cpp +++ b/scsitape.cpp @@ -64,7 +64,7 @@ static void tape_init (int unit, struct scsi_data_tape *tape, const TCHAR *tape_ TCHAR tape_dir_path[MAX_DPATH]; memset (tape, 0, sizeof (struct scsi_data_tape)); - cfgfile_resolve_path_out(tape_directory, tape_dir_path, MAX_DPATH, PATH_TAPE); + cfgfile_resolve_path_out_load(tape_directory, tape_dir_path, MAX_DPATH, PATH_TAPE); _tcscpy(tape->tape_dir, tape_dir_path); path[0] = 0; diff --git a/x86.cpp b/x86.cpp index 7a76447e..56879b3a 100644 --- a/x86.cpp +++ b/x86.cpp @@ -3387,7 +3387,7 @@ bool x86_bridge_init(struct autoconfig_info *aci, uae_u32 romtype, int type) FPU_Init(dosbox_sec); if (xb->type >= TYPE_2286) { TCHAR path[MAX_DPATH]; - cfgfile_resolve_path_out(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); + cfgfile_resolve_path_out_load(currprefs.flashfile, path, MAX_DPATH, PATH_ROM); xb->cmossize = xb->type == TYPE_2386 ? 192 : 64; xb->cmosfile = zfile_fopen(path, _T("rb+"), ZFD_NORMAL); if (!xb->cmosfile) { -- 2.47.3