summaryrefslogtreecommitdiffstats
path: root/generic/tclPathObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclPathObj.c')
-rw-r--r--generic/tclPathObj.c89
1 files changed, 8 insertions, 81 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index f7f2132..cd3f9f9 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -10,14 +10,11 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPathObj.c,v 1.24 2004/03/09 12:59:05 vincentdarley Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.25 2004/03/17 18:14:14 das Exp $
*/
#include "tclInt.h"
#include "tclPort.h"
-#ifdef MAC_TCL
-#include "tclMacInt.h"
-#endif
#include "tclFileSystem.h"
/*
@@ -131,7 +128,7 @@ typedef struct FsPath {
*
* A normalized path is one which has all '../', './' removed.
* Also it is one which is in the 'standard' format for the native
- * platform. On MacOS, Unix, this means the path must be free of
+ * platform. On Unix, this means the path must be free of
* symbolic links/aliases, and on Windows it means we want the
* long form, with that long form's case-dependence (which gives
* us a unique, case-dependent path).
@@ -363,7 +360,7 @@ TclFSNormalizeAbsolutePath(interp, pathPtr, clientDataPtr)
* platform. For instance, Unix is case-sensitive, so the
* path is ok. Windows is case-insensitive, and also has the
* weird 'longname/shortname' thing (e.g. C:/Program Files/ and
- * C:/Progra~1/ are equivalent). MacOS is case-insensitive.
+ * C:/Progra~1/ are equivalent).
*
* Virtual file systems which may be registered may have
* other criteria for normalizing a path.
@@ -627,8 +624,7 @@ TclPathPart(interp, pathPtr, portion)
resultPtr = Tcl_FSJoinPath(splitPtr, splitElements - 1);
} else if (splitElements == 0 ||
(Tcl_FSGetPathType(pathPtr) == TCL_PATH_RELATIVE)) {
- resultPtr = Tcl_NewStringObj(
- ((tclPlatform == TCL_PLATFORM_MAC) ? ":" : "."), 1);
+ resultPtr = Tcl_NewStringObj(".", 1);
} else {
Tcl_ListObjIndex(NULL, splitPtr, 0, &resultPtr);
}
@@ -755,7 +751,7 @@ Tcl_FSJoinPath(listObj, elements)
return elt;
}
/*
- * If it doesn't begin with '.' and is a mac or unix
+ * If it doesn't begin with '.' and is a unix
* path or it a windows path without backslashes, then we
* can be very efficient here. (In fact even a windows
* path with backslashes can be joined efficiently, but
@@ -786,11 +782,6 @@ Tcl_FSJoinPath(listObj, elements)
if (res != NULL) Tcl_DecrRefCount(res);
return tail;
}
- } else if (tclPlatform == TCL_PLATFORM_MAC) {
- if (strchr(str, '/') == NULL) {
- if (res != NULL) Tcl_DecrRefCount(res);
- return tail;
- }
}
}
}
@@ -841,7 +832,7 @@ Tcl_FSJoinPath(listObj, elements)
equal = 0;
}
}
- if (equal && (tclPlatform != TCL_PLATFORM_MAC)) {
+ if (equal) {
ptr = strElt;
while (*ptr != '\0') {
if (*ptr == '/' && (ptr[1] == '/' || ptr[1] == '\0')) {
@@ -850,27 +841,6 @@ Tcl_FSJoinPath(listObj, elements)
}
ptr++;
}
- }
- if (equal && (tclPlatform == TCL_PLATFORM_MAC)) {
- /*
- * If it contains any colons, then it mustn't contain
- * any duplicates. Otherwise, the path is in unix-form
- * and is no good.
- */
- if (strchr(strElt, ':') != NULL) {
- ptr = strElt;
- while (*ptr != '\0') {
- if (*ptr == ':' && (ptr[1] == ':' || ptr[1] == '\0')) {
- equal = 0;
- break;
- }
- ptr++;
- }
- } else {
- equal = 0;
- }
- }
- if (equal) {
if (res != NULL) Tcl_DecrRefCount(res);
/*
* This element is just what we want to return already -
@@ -1036,9 +1006,6 @@ IsSeparatorOrNull(ch)
case TCL_PLATFORM_UNIX: {
return (ch == '/' ? 1 : 0);
}
- case TCL_PLATFORM_MAC: {
- return (ch == ':' ? 1 : 0);
- }
case TCL_PLATFORM_WINDOWS: {
return ((ch == '/' || ch == '\\') ? 1 : 0);
}
@@ -1059,7 +1026,6 @@ FindSplitPos(path, separator)
int count = 0;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
- case TCL_PLATFORM_MAC:
while (path[count] != 0) {
if (path[count] == separator) {
return count;
@@ -1115,18 +1081,6 @@ TclNewFSPathObj(Tcl_Obj *dirPtr, CONST char *addStrRep, int len)
pathPtr = Tcl_NewObj();
fsPathPtr = (FsPath*)ckalloc((unsigned)sizeof(FsPath));
- if (tclPlatform == TCL_PLATFORM_MAC) {
- /*
- * Mac relative paths may begin with a directory separator ':'.
- * If present, we need to skip this ':' because we assume that
- * we can join dirPtr and addStrRep by concatenating them as
- * strings (and we ensure that dirPtr is terminated by a ':').
- */
- if (addStrRep[0] == ':') {
- addStrRep++;
- len--;
- }
- }
/* Setup the path */
fsPathPtr->translatedPathPtr = NULL;
fsPathPtr->normPathPtr = Tcl_NewStringObj(addStrRep, len);
@@ -1251,11 +1205,6 @@ TclFSMakePathRelative(interp, pathPtr, cwdPtr)
cwdLen++;
}
break;
- case TCL_PLATFORM_MAC:
- if (tempStr[cwdLen-1] != ':') {
- cwdLen++;
- }
- break;
}
tempStr = Tcl_GetStringFromObj(pathPtr, &len);
@@ -1574,12 +1523,6 @@ Tcl_FSGetNormalizedPath(interp, pathPtr)
cwdLen++;
}
break;
- case TCL_PLATFORM_MAC:
- if (cwdStr[cwdLen-1] != ':') {
- Tcl_AppendToObj(copy, ":", 1);
- cwdLen++;
- }
- break;
}
Tcl_AppendObjToObj(copy, fsPathPtr->normPathPtr);
/*
@@ -1662,12 +1605,6 @@ Tcl_FSGetNormalizedPath(interp, pathPtr)
cwdLen++;
}
break;
- case TCL_PLATFORM_MAC:
- if (cwdStr[cwdLen-1] != ':') {
- Tcl_AppendToObj(copy, ":", 1);
- cwdLen++;
- }
- break;
}
Tcl_AppendObjToObj(copy, pathPtr);
/*
@@ -2104,8 +2041,8 @@ SetFsPathFromAny(interp, pathPtr)
* We remove any trailing directory separator.
*
* However, the split/join routines are quite complex, and
- * one has to make sure not to break anything on Unix, Win
- * or MacOS (fCmd.test, fileName.test and cmdAH.test exercise
+ * one has to make sure not to break anything on Unix or Win
+ * (fCmd.test, fileName.test and cmdAH.test exercise
* most of the code).
*/
name = Tcl_GetStringFromObj(pathPtr,&len);
@@ -2119,10 +2056,6 @@ SetFsPathFromAny(interp, pathPtr)
int split;
char separator='/';
- if (tclPlatform==TCL_PLATFORM_MAC) {
- if (strchr(name, ':') != NULL) separator = ':';
- }
-
split = FindSplitPos(name, separator);
if (split != len) {
/* We have multiple pieces '~user/foo/bar...' */
@@ -2418,12 +2351,6 @@ UpdateStringOfFsPath(pathPtr)
}
}
break;
- case TCL_PLATFORM_MAC:
- if (cwdStr[cwdLen-1] != ':') {
- Tcl_AppendToObj(copy, ":", 1);
- cwdLen++;
- }
- break;
}
Tcl_AppendObjToObj(copy, fsPathPtr->normPathPtr);
pathPtr->bytes = Tcl_GetStringFromObj(copy, &cwdLen);