*
* @note If the passed ret->m_name is mangled, we'll demangle it
*/
-static int cname_mtouname(const struct vol *vol, const struct dir *dir, struct path *ret, int toUTF8)
+static int cname_mtouname(const struct vol *vol, struct dir *dir, struct path *ret, int toUTF8)
{
static char temp[ MAXPATHLEN + 1];
char *t;
/* check for OS X mangled filename :( */
t = demangle_osx(vol, ret->m_name, dir->d_did, &fileid);
+
+ if (curdir == NULL) {
+ /* demangle_osx() calls dirlookup() which might have clobbered curdir */
+ movecwd(vol, dir);
+ }
+
LOG(log_maxdebug, logtype_afpd, "cname_mtouname('%s',did:%u) {demangled:'%s', fileid:%u}",
ret->m_name, ntohl(dir->d_did), t, ntohl(fileid));
memcpy( data, ad_entry( &ad, ADEID_FINDERI ), 32 );
} else { /* no appledouble */
memset( data, 0, 32 );
- /* set default view -- this also gets done in ad_open() */
- ashort = htons(FINDERINFO_CLOSEDVIEW);
- memcpy(data + FINDERINFO_FRVIEWOFF, &ashort, sizeof(ashort));
-
/* dot files are by default visible */
if (invisible_dots(vol, cfrombstr(dir->d_u_name))) {
ashort = htons(FINDERINFO_INVISIBLE);