Ticket #27649: show_in_finder.diff

File show_in_finder.diff, 1.7 KB (added by markus.doits@…, 14 years ago)

to place in /files/

  • src/ntfs-3g.c

    old new  
    44074407        err = ntfs_open(opts.device);
    44084408        if (err)
    44094409                goto err_out;
     4410
     4411#if defined(__APPLE__) || defined(__DARWIN__)
     4412        /* If the volume has a volume name, then append the MacFUSE-specific
     4413         * 'volname' option, making the volume name appear in Finder. */
     4414        if (ctx->vol->vol_name) {
     4415                int i;
     4416                size_t vol_name_len = strlen(ctx->vol->vol_name);
     4417                char *scrubbed_vol_name =
     4418                        calloc(1, sizeof(char) * (vol_name_len + 1));
     4419                if (scrubbed_vol_name == NULL)
     4420                        goto err_out;
     4421
     4422                /* Scrub all ',' characters from the volume name since they
     4423                 * would interfere with FUSE argument delimiters. */
     4424                for (i = 0; i < vol_name_len; ++i) {
     4425                        char cur = ctx->vol->vol_name[i];
     4426                        if(cur == ',')
     4427                                scrubbed_vol_name[i] = '_';
     4428                        else
     4429                                scrubbed_vol_name[i] = cur;
     4430                }
     4431
     4432                scrubbed_vol_name[i] = '\0';
     4433
     4434                if (strappend(&parsed_options, ",volname="))
     4435                        goto err_out;
     4436                if (strappend(&parsed_options, scrubbed_vol_name))
     4437                        goto err_out;
     4438
     4439                free(scrubbed_vol_name);
     4440        }
     4441#endif /* defined(__APPLE__) || defined(__DARWIN__) */
    44104442       
    44114443        /* We must do this after ntfs_open() to be able to set the blksize */
    44124444        if (ctx->blkdev && set_fuseblk_options(&parsed_options))