The R Project SVN R

Rev

Rev 85614 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 85614 Rev 85648
Line 670... Line 670...
670
SEXP do_normalizepath(SEXP call, SEXP op, SEXP args, SEXP rho)
670
SEXP do_normalizepath(SEXP call, SEXP op, SEXP args, SEXP rho)
671
{
671
{
672
    SEXP ans, paths = CAR(args), el, slash;
672
    SEXP ans, paths = CAR(args), el, slash;
673
    int i, n = LENGTH(paths);
673
    int i, n = LENGTH(paths);
674
    int mustWork, fslash = 0;
674
    int mustWork, fslash = 0;
-
 
675
    const void *vmax = vmaxget();
675
 
676
 
676
    checkArity(op, args);
677
    checkArity(op, args);
677
    if(!isString(paths))
678
    if(!isString(paths))
678
	errorcall(call, _("'path' must be a character vector"));
679
	errorcall(call, _("'path' must be a character vector"));
679
 
680
 
680
    slash = CADR(args);
681
    slash = CADR(args);
681
    if(!isString(slash) || LENGTH(slash) != 1)
682
    if(!isString(slash) || LENGTH(slash) != 1)
682
	errorcall(call, "'winslash' must be a character string");
683
	errorcall(call, "'winslash' must be a character string");
683
    const char *sl = CHAR(STRING_ELT(slash, 0));
684
    const char *sl = translateCharFP(STRING_ELT(slash, 0));
684
    if (strcmp(sl, "/") && strcmp(sl, "\\"))
685
    if (strcmp(sl, "/") && strcmp(sl, "\\"))
685
	errorcall(call, "'winslash' must be '/' or '\\\\'");
686
	errorcall(call, "'winslash' must be '/' or '\\\\'");
686
    if (strcmp(sl, "/") == 0) fslash = 1;
687
    if (strcmp(sl, "/") == 0) fslash = 1;
687
    
688
    
688
    mustWork = asLogical(CADDR(args));
689
    mustWork = asLogical(CADDR(args));
Line 777... Line 778...
777
		    result = mkChar(tel);
778
		    result = mkChar(tel);
778
	    }
779
	    }
779
	}
780
	}
780
	SET_STRING_ELT(ans, i, result);
781
	SET_STRING_ELT(ans, i, result);
781
    }
782
    }
-
 
783
    vmaxset(vmax);
782
    UNPROTECT(1);
784
    UNPROTECT(1);
783
    return ans;
785
    return ans;
784
}
786
}
785
 
787
 
786
/* utils::shortPathName */
788
/* utils::shortPathName */