vfs.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. /* Virtual File System switch code
  2. Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
  3. 2007 Free Software Foundation, Inc.
  4. Written by: 1995 Miguel de Icaza
  5. 1995 Jakub Jelinek
  6. 1998 Pavel Machek
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Library General Public License
  9. as published by the Free Software Foundation; either version 2 of
  10. the License, or (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU Library General Public License for more details.
  15. You should have received a copy of the GNU Library General Public
  16. License along with this program; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  18. /**
  19. * \file
  20. * \brief Source: Virtual File System switch code
  21. * \author Miguel de Icaza
  22. * \author Jakub Jelinek
  23. * \author Pavel Machek
  24. * \date 1995, 1998
  25. * \warning funtions like extfs_lstat() have right to destroy any
  26. * strings you pass to them. This is acutally ok as you g_strdup what
  27. * you are passing to them, anyway; still, beware.
  28. *
  29. * Namespace: exports *many* functions with vfs_ prefix; exports
  30. * parse_ls_lga and friends which do not have that prefix.
  31. */
  32. #include <config.h>
  33. #include <errno.h>
  34. #include "lib/global.h"
  35. #include "lib/strutil.h"
  36. #include "lib/util.h"
  37. #include "lib/widget.h" /* message() */
  38. #include "lib/event.h"
  39. #ifdef HAVE_CHARSET
  40. #include "lib/charsets.h"
  41. #endif
  42. #include "vfs.h"
  43. #include "utilvfs.h"
  44. #include "gc.h"
  45. extern struct dirent *mc_readdir_result;
  46. /*** global variables ****************************************************************************/
  47. GPtrArray *vfs__classes_list = NULL;
  48. GString *vfs_str_buffer = NULL;
  49. struct vfs_class *current_vfs = NULL;
  50. /*** file scope macro definitions ****************************************************************/
  51. #if defined(_AIX) && !defined(NAME_MAX)
  52. #define NAME_MAX FILENAME_MAX
  53. #endif
  54. #define VFS_FIRST_HANDLE 100
  55. #define ISSLASH(a) (!a || (a == '/'))
  56. /*** file scope type declarations ****************************************************************/
  57. struct vfs_openfile
  58. {
  59. int handle;
  60. struct vfs_class *vclass;
  61. void *fsinfo;
  62. };
  63. /*** file scope variables ************************************************************************/
  64. /** They keep track of the current directory */
  65. static vfs_path_t *current_path = NULL;
  66. static GPtrArray *vfs_openfiles;
  67. static long vfs_free_handle_list = -1;
  68. static const struct
  69. {
  70. const char *name;
  71. size_t name_len;
  72. const char *substitute;
  73. } url_table[] =
  74. {
  75. /* *INDENT-OFF* */
  76. #ifdef ENABLE_VFS_FTP
  77. { "ftp://", 6, "/#ftp:" },
  78. #endif
  79. #ifdef ENABLE_VFS_FISH
  80. { "sh://", 5, "/#sh:" },
  81. { "ssh://", 6, "/#sh:" },
  82. #endif
  83. #ifdef ENABLE_VFS_SMB
  84. { "smb://", 6, "/#smb:" },
  85. #endif
  86. { "a:", 2, "/#a" }
  87. /* *INDENT-ON* */
  88. };
  89. /*** file scope functions ************************************************************************/
  90. /* --------------------------------------------------------------------------------------------- */
  91. static gboolean
  92. path_magic (const char *path)
  93. {
  94. struct stat buf;
  95. return (stat (path, &buf) != 0);
  96. }
  97. /* --------------------------------------------------------------------------------------------- */
  98. static struct vfs_class *
  99. _vfs_get_class (char *path)
  100. {
  101. char *semi;
  102. char *slash;
  103. struct vfs_class *ret;
  104. g_return_val_if_fail (path, NULL);
  105. semi = strrchr (path, '#');
  106. if (semi == NULL || !path_magic (path))
  107. return NULL;
  108. slash = strchr (semi, PATH_SEP);
  109. *semi = '\0';
  110. if (slash != NULL)
  111. *slash = '\0';
  112. ret = vfs_prefix_to_class (semi + 1);
  113. if (slash != NULL)
  114. *slash = PATH_SEP;
  115. if (ret == NULL)
  116. ret = _vfs_get_class (path);
  117. *semi = '#';
  118. return ret;
  119. }
  120. /* --------------------------------------------------------------------------------------------- */
  121. /* now used only by vfs_translate_path, but could be used in other vfs
  122. * plugin to automatic detect encoding
  123. * path - path to translate
  124. * size - how many bytes from path translate
  125. * defcnv - convertor, that is used as default, when path does not contain any
  126. * #enc: subtring
  127. * buffer - used to store result of translation
  128. */
  129. static estr_t
  130. _vfs_translate_path (const char *path, int size, GIConv defcnv, GString * buffer)
  131. {
  132. const char *semi;
  133. const char *slash;
  134. estr_t state = ESTR_SUCCESS;
  135. if (size == 0)
  136. return ESTR_SUCCESS;
  137. size = (size > 0) ? size : (signed int) strlen (path);
  138. /* try found /#enc: */
  139. semi = g_strrstr_len (path, size, PATH_SEP_STR VFS_ENCODING_PREFIX);
  140. if (semi != NULL)
  141. {
  142. char encoding[16];
  143. GIConv coder = INVALID_CONV;
  144. int ms;
  145. /* first must be translated part before /#enc: */
  146. ms = semi - path;
  147. state = _vfs_translate_path (path, ms, defcnv, buffer);
  148. if (state != ESTR_SUCCESS)
  149. return state;
  150. /* now can be translated part after #enc: */
  151. semi += strlen (VFS_ENCODING_PREFIX) + 1; /* skip "/#enc:" */
  152. slash = strchr (semi, PATH_SEP);
  153. /* ignore slashes after size; */
  154. if (slash - path >= size)
  155. slash = NULL;
  156. ms = (slash != NULL) ? slash - semi : (int) strlen (semi);
  157. ms = min ((unsigned int) ms, sizeof (encoding) - 1);
  158. /* limit encoding size (ms) to path size (size) */
  159. if (semi + ms > path + size)
  160. ms = path + size - semi;
  161. memcpy (encoding, semi, ms);
  162. encoding[ms] = '\0';
  163. #if HAVE_CHARSET
  164. if (is_supported_encoding (encoding))
  165. coder = str_crt_conv_to (encoding);
  166. #endif
  167. if (coder != INVALID_CONV)
  168. {
  169. if (slash != NULL)
  170. state = str_vfs_convert_to (coder, slash, path + size - slash, buffer);
  171. else if (buffer->len == 0)
  172. g_string_append_c (buffer, PATH_SEP);
  173. str_close_conv (coder);
  174. return state;
  175. }
  176. errno = EINVAL;
  177. state = ESTR_FAILURE;
  178. }
  179. else
  180. {
  181. /* path can be translated whole at once */
  182. state = str_vfs_convert_to (defcnv, path, size, buffer);
  183. }
  184. return state;
  185. }
  186. /* --------------------------------------------------------------------------------------------- */
  187. /*** public functions ****************************************************************************/
  188. /* --------------------------------------------------------------------------------------------- */
  189. /** Free open file data for given file handle */
  190. void
  191. vfs_free_handle (int handle)
  192. {
  193. const int idx = handle - VFS_FIRST_HANDLE;
  194. if (handle >= VFS_FIRST_HANDLE && (guint) idx < vfs_openfiles->len)
  195. {
  196. struct vfs_openfile *h;
  197. h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, idx);
  198. g_free (h);
  199. g_ptr_array_index (vfs_openfiles, idx) = (void *) vfs_free_handle_list;
  200. vfs_free_handle_list = idx;
  201. }
  202. }
  203. /* --------------------------------------------------------------------------------------------- */
  204. /** Find private file data by file handle */
  205. void *
  206. vfs_class_data_find_by_handle (int handle)
  207. {
  208. struct vfs_openfile *h;
  209. if (handle < VFS_FIRST_HANDLE || (guint) (handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
  210. return NULL;
  211. h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE);
  212. if (!h)
  213. return NULL;
  214. g_assert (h->handle == handle);
  215. return h->fsinfo;
  216. }
  217. /* --------------------------------------------------------------------------------------------- */
  218. /** Find VFS class by file handle */
  219. struct vfs_class *
  220. vfs_class_find_by_handle (int handle)
  221. {
  222. struct vfs_openfile *h;
  223. if (handle < VFS_FIRST_HANDLE || (guint) (handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
  224. return NULL;
  225. h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE);
  226. if (!h)
  227. return NULL;
  228. g_assert (h->handle == handle);
  229. return h->vclass;
  230. }
  231. /* --------------------------------------------------------------------------------------------- */
  232. /**
  233. * Create new VFS handle and put it to the list
  234. */
  235. int
  236. vfs_new_handle (struct vfs_class *vclass, void *fsinfo)
  237. {
  238. struct vfs_openfile *h;
  239. h = g_new (struct vfs_openfile, 1);
  240. h->fsinfo = fsinfo;
  241. h->vclass = vclass;
  242. /* Allocate the first free handle */
  243. h->handle = vfs_free_handle_list;
  244. if (h->handle == -1)
  245. {
  246. /* No free allocated handles, allocate one */
  247. h->handle = vfs_openfiles->len;
  248. g_ptr_array_add (vfs_openfiles, h);
  249. }
  250. else
  251. {
  252. vfs_free_handle_list = (long) g_ptr_array_index (vfs_openfiles, vfs_free_handle_list);
  253. g_ptr_array_index (vfs_openfiles, h->handle) = h;
  254. }
  255. h->handle += VFS_FIRST_HANDLE;
  256. return h->handle;
  257. }
  258. /* --------------------------------------------------------------------------------------------- */
  259. int
  260. vfs_ferrno (struct vfs_class *vfs)
  261. {
  262. return vfs->ferrno ? (*vfs->ferrno) (vfs) : E_UNKNOWN;
  263. /* Hope that error message is obscure enough ;-) */
  264. }
  265. /* --------------------------------------------------------------------------------------------- */
  266. gboolean
  267. vfs_register_class (struct vfs_class * vfs)
  268. {
  269. if (vfs->init != NULL) /* vfs has own initialization function */
  270. if (!vfs->init (vfs)) /* but it failed */
  271. return FALSE;
  272. g_ptr_array_add (vfs__classes_list, vfs);
  273. return TRUE;
  274. }
  275. /* --------------------------------------------------------------------------------------------- */
  276. /** Strip known vfs suffixes from a filename (possible improvement: strip
  277. * suffix from last path component).
  278. * \return a malloced string which has to be freed.
  279. */
  280. char *
  281. vfs_strip_suffix_from_filename (const char *filename)
  282. {
  283. guint i;
  284. char *semi;
  285. char *p;
  286. if (filename == NULL)
  287. vfs_die ("vfs_strip_suffix_from_path got NULL: impossible");
  288. p = g_strdup (filename);
  289. semi = strrchr (p, '#');
  290. if (semi == NULL)
  291. return p;
  292. /* Avoid first class (localfs) that would accept any prefix */
  293. for (i = 1; i < vfs__classes_list->len; i++)
  294. {
  295. struct vfs_class *vfs = (struct vfs_class *) g_ptr_array_index (vfs__classes_list, i);
  296. if (vfs->which != NULL)
  297. {
  298. if (vfs->which (vfs, semi + 1) == -1)
  299. continue;
  300. *semi = '\0'; /* Found valid suffix */
  301. break;
  302. }
  303. if (vfs->prefix != NULL && strncmp (semi + 1, vfs->prefix, strlen (vfs->prefix)) == 0)
  304. {
  305. *semi = '\0'; /* Found valid suffix */
  306. break;
  307. }
  308. }
  309. return p;
  310. }
  311. /* --------------------------------------------------------------------------------------------- */
  312. struct vfs_class *
  313. vfs_get_class (const char *pathname)
  314. {
  315. char *path;
  316. struct vfs_class *vfs;
  317. path = g_strdup (pathname);
  318. vfs = _vfs_get_class (path);
  319. g_free (path);
  320. if (vfs == NULL)
  321. vfs = g_ptr_array_index (vfs__classes_list, 0); /* localfs */
  322. return vfs;
  323. }
  324. /* --------------------------------------------------------------------------------------------- */
  325. const char *
  326. vfs_get_encoding (const char *path)
  327. {
  328. static char result[16];
  329. char *work;
  330. char *semi;
  331. char *slash;
  332. work = g_strdup (path);
  333. /* try found /#enc: */
  334. semi = g_strrstr (work, PATH_SEP_STR VFS_ENCODING_PREFIX);
  335. if (semi != NULL)
  336. {
  337. semi += strlen (VFS_ENCODING_PREFIX) + 1; /* skip "/#enc:" */
  338. slash = strchr (semi, PATH_SEP);
  339. if (slash != NULL)
  340. slash[0] = '\0';
  341. g_strlcpy (result, semi, sizeof (result));
  342. g_free (work);
  343. return result;
  344. }
  345. else
  346. {
  347. g_free (work);
  348. return NULL;
  349. }
  350. }
  351. /* --------------------------------------------------------------------------------------------- */
  352. char *
  353. vfs_translate_path (const char *path)
  354. {
  355. estr_t state;
  356. g_string_set_size (vfs_str_buffer, 0);
  357. state = _vfs_translate_path (path, -1, str_cnv_from_term, vfs_str_buffer);
  358. /*
  359. strict version
  360. return (state == 0) ? vfs_str_buffer->data : NULL;
  361. */
  362. return (state != ESTR_FAILURE) ? vfs_str_buffer->str : NULL;
  363. }
  364. /* --------------------------------------------------------------------------------------------- */
  365. char *
  366. vfs_translate_path_n (const char *path)
  367. {
  368. char *result;
  369. result = vfs_translate_path (path);
  370. return (result != NULL) ? g_strdup (result) : NULL;
  371. }
  372. /* --------------------------------------------------------------------------------------------- */
  373. char *
  374. vfs_canon_and_translate (const char *path)
  375. {
  376. char *canon;
  377. char *result;
  378. if (path == NULL)
  379. canon = g_strdup ("");
  380. else
  381. canon = vfs_canon (path);
  382. result = vfs_translate_path_n (canon);
  383. g_free (canon);
  384. return result;
  385. }
  386. /* --------------------------------------------------------------------------------------------- */
  387. /**
  388. * Get current directory without any OS calls.
  389. *
  390. * @return string contain current path
  391. */
  392. char *
  393. vfs_get_current_dir (void)
  394. {
  395. return vfs_path_to_str (current_path);
  396. }
  397. /* --------------------------------------------------------------------------------------------- */
  398. /**
  399. * Get raw current directory object without any OS calls.
  400. *
  401. * @return object contain current path
  402. */
  403. vfs_path_t *
  404. vfs_get_raw_current_dir (void)
  405. {
  406. return current_path;
  407. }
  408. /* --------------------------------------------------------------------------------------------- */
  409. /**
  410. * Set current directory object.
  411. *
  412. * @param vpath new path
  413. */
  414. void
  415. vfs_set_raw_current_dir (const vfs_path_t * vpath)
  416. {
  417. if (current_path != NULL)
  418. vfs_path_free (current_path);
  419. current_path = (vfs_path_t *) vpath;
  420. }
  421. /* --------------------------------------------------------------------------------------------- */
  422. /**
  423. * remove //, /./ and /../
  424. */
  425. char *
  426. vfs_canon (const char *path)
  427. {
  428. if (!path)
  429. vfs_die ("Cannot canonicalize NULL");
  430. /* Relative to current directory */
  431. if (*path != PATH_SEP)
  432. {
  433. char *local, *result, *curr_dir;
  434. curr_dir = vfs_get_current_dir ();
  435. local = concat_dir_and_file (curr_dir, path);
  436. g_free (curr_dir);
  437. result = vfs_canon (local);
  438. g_free (local);
  439. return result;
  440. }
  441. /*
  442. * So we have path of following form:
  443. * /p1/p2#op/.././././p3#op/p4. Good luck.
  444. */
  445. {
  446. char *result = g_strdup (path);
  447. canonicalize_pathname (result);
  448. return result;
  449. }
  450. }
  451. /* --------------------------------------------------------------------------------------------- */
  452. /* Return TRUE is the current VFS class is local */
  453. gboolean
  454. vfs_current_is_local (void)
  455. {
  456. return (current_vfs->flags & VFSF_LOCAL) != 0;
  457. }
  458. /* --------------------------------------------------------------------------------------------- */
  459. /* Return flags of the VFS class of the given filename */
  460. vfs_class_flags_t
  461. vfs_file_class_flags (const vfs_path_t * vpath)
  462. {
  463. vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
  464. if (path_element == NULL)
  465. return VFSF_UNKNOWN;
  466. return path_element->class->flags;
  467. }
  468. /* --------------------------------------------------------------------------------------------- */
  469. void
  470. vfs_init (void)
  471. {
  472. /* create the VFS handle arrays */
  473. vfs__classes_list = g_ptr_array_new ();
  474. /* create the VFS handle array */
  475. vfs_openfiles = g_ptr_array_new ();
  476. vfs_str_buffer = g_string_new ("");
  477. }
  478. /* --------------------------------------------------------------------------------------------- */
  479. void
  480. vfs_setup_work_dir (void)
  481. {
  482. vfs_path_element_t *path_element;
  483. g_free (_vfs_get_cwd ());
  484. /* FIXME: is we really need for this check? */
  485. /*
  486. if (strlen (current_dir) > MC_MAXPATHLEN - 2)
  487. vfs_die ("Current dir too long.\n");
  488. */
  489. path_element = vfs_path_get_by_index (current_path, -1);
  490. current_vfs = path_element->class;
  491. }
  492. /* --------------------------------------------------------------------------------------------- */
  493. void
  494. vfs_shut (void)
  495. {
  496. guint i;
  497. vfs_gc_done ();
  498. vfs_set_raw_current_dir (NULL);
  499. for (i = 0; i < vfs__classes_list->len; i++)
  500. {
  501. struct vfs_class *vfs = (struct vfs_class *) g_ptr_array_index (vfs__classes_list, i);
  502. if (vfs->done != NULL)
  503. vfs->done (vfs);
  504. }
  505. g_ptr_array_free (vfs_openfiles, TRUE);
  506. g_ptr_array_free (vfs__classes_list, TRUE);
  507. g_string_free (vfs_str_buffer, TRUE);
  508. g_free (mc_readdir_result);
  509. }
  510. /* --------------------------------------------------------------------------------------------- */
  511. /**
  512. * These ones grab information from the VFS
  513. * and handles them to an upper layer
  514. */
  515. void
  516. vfs_fill_names (fill_names_f func)
  517. {
  518. guint i;
  519. for (i = 0; i < vfs__classes_list->len; i++)
  520. {
  521. struct vfs_class *vfs = (struct vfs_class *) g_ptr_array_index (vfs__classes_list, i);
  522. if (vfs->fill_names != NULL)
  523. vfs->fill_names (vfs, func);
  524. }
  525. }
  526. /* --------------------------------------------------------------------------------------------- */
  527. /**
  528. * Returns vfs path corresponding to given url. If passed string is
  529. * not recognized as url, g_strdup(url) is returned.
  530. */
  531. char *
  532. vfs_translate_url (const char *url)
  533. {
  534. size_t i;
  535. for (i = 0; i < sizeof (url_table) / sizeof (url_table[0]); i++)
  536. if (strncmp (url, url_table[i].name, url_table[i].name_len) == 0)
  537. return g_strconcat (url_table[i].substitute, url + url_table[i].name_len,
  538. (char *) NULL);
  539. return g_strdup (url);
  540. }
  541. /* --------------------------------------------------------------------------------------------- */
  542. gboolean
  543. vfs_file_is_local (const vfs_path_t * vpath)
  544. {
  545. return (vfs_file_class_flags (vpath) & VFSF_LOCAL) != 0;
  546. }
  547. /* --------------------------------------------------------------------------------------------- */
  548. void
  549. vfs_print_message (const char *msg, ...)
  550. {
  551. ev_vfs_print_message_t event_data;
  552. va_start (event_data.ap, msg);
  553. event_data.msg = msg;
  554. mc_event_raise (MCEVENT_GROUP_CORE, "vfs_print_message", (gpointer) & event_data);
  555. va_end (event_data.ap);
  556. }
  557. /* --------------------------------------------------------------------------------------------- */
  558. /**
  559. * Return current directory. If it's local, reread the current directory
  560. * from the OS. You must g_strdup() whatever this function returns.
  561. */
  562. char *
  563. _vfs_get_cwd (void)
  564. {
  565. char *trans, *curr_dir;
  566. if (vfs_get_raw_current_dir() == NULL)
  567. {
  568. char *tmp;
  569. tmp = g_get_current_dir ();
  570. vfs_set_raw_current_dir (vfs_path_from_str (tmp));
  571. g_free(tmp);
  572. }
  573. curr_dir = vfs_get_current_dir ();
  574. trans = vfs_translate_path_n (curr_dir);
  575. if (_vfs_get_class (trans) == NULL)
  576. {
  577. const char *encoding = vfs_get_encoding (curr_dir);
  578. if (encoding == NULL)
  579. {
  580. char *tmp;
  581. tmp = g_get_current_dir ();
  582. if (tmp != NULL)
  583. { /* One of the directories in the path is not readable */
  584. estr_t state;
  585. g_string_set_size (vfs_str_buffer, 0);
  586. state = str_vfs_convert_from (str_cnv_from_term, tmp, vfs_str_buffer);
  587. g_free (tmp);
  588. if (state == ESTR_SUCCESS)
  589. {
  590. struct stat my_stat, my_stat2;
  591. /* Check if it is O.K. to use the current_dir */
  592. if (!(mc_global.vfs.cd_symlinks
  593. && mc_stat (vfs_str_buffer->str, &my_stat) == 0
  594. && mc_stat (curr_dir, &my_stat2) == 0
  595. && my_stat.st_ino == my_stat2.st_ino
  596. && my_stat.st_dev == my_stat2.st_dev))
  597. {
  598. vfs_set_raw_current_dir (vfs_path_from_str (vfs_str_buffer->str));
  599. }
  600. }
  601. }
  602. }
  603. }
  604. g_free (trans);
  605. return curr_dir;
  606. }
  607. /* --------------------------------------------------------------------------------------------- */