| ︙ | | | ︙ | |
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
|
* normalized pathname changes.
*
* Tcl has no control over (2) and (3), so each registered filesystem must
* call Tcl_FSMountsChnaged in each of those circumstances.
*
* The reason for the exception in 2,3 for the native filesystem is that
* the native filesystem claims every file without determining whether
* whether the file exists, or even whether the pathname makes sense.
*
*----------------------------------------------------------------------
*/
void
Tcl_FSMountsChanged(
TCL_UNUSED(const Tcl_Filesystem *) /*fsPtr*/)
|
|
|
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
|
* normalized pathname changes.
*
* Tcl has no control over (2) and (3), so each registered filesystem must
* call Tcl_FSMountsChnaged in each of those circumstances.
*
* The reason for the exception in 2,3 for the native filesystem is that
* the native filesystem claims every file without determining whether
* the file exists, or even whether the pathname makes sense.
*
*----------------------------------------------------------------------
*/
void
Tcl_FSMountsChanged(
TCL_UNUSED(const Tcl_Filesystem *) /*fsPtr*/)
|
| ︙ | | | ︙ | |
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
|
* this is implemented in the C library as a thread-local value , but this
* is *really* unsafe to assume!
*
* Results:
* None.
*
* Side effects:
* Modifies the the Tcl error code value.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetErrno(
int err) /* The new value. */
|
|
|
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
|
* this is implemented in the C library as a thread-local value , but this
* is *really* unsafe to assume!
*
* Results:
* None.
*
* Side effects:
* Modifies the Tcl error code value.
*
*----------------------------------------------------------------------
*/
void
Tcl_SetErrno(
int err) /* The new value. */
|
| ︙ | | | ︙ | |
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
|
retVal = fsPtr->internalToNormalizedProc(retCd);
Tcl_IncrRefCount(retVal);
}
if (retVal == NULL) {
/*
* The current directory could not not determined. Reset the
* current direcory to ensure, for example, that 'pwd' does actually
* throw the correct error in Tcl. This is tested for in the test
* suite on unix.
*/
FsUpdateCwd(NULL, NULL);
goto cdDidNotChange;
|
|
|
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
|
retVal = fsPtr->internalToNormalizedProc(retCd);
Tcl_IncrRefCount(retVal);
}
if (retVal == NULL) {
/*
* The current directory could not be determined. Reset the
* current direcory to ensure, for example, that 'pwd' does actually
* throw the correct error in Tcl. This is tested for in the test
* suite on unix.
*/
FsUpdateCwd(NULL, NULL);
goto cdDidNotChange;
|
| ︙ | | | ︙ | |
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
|
TclFSGetCwdProc2 *proc2 = (TclFSGetCwdProc2 *) fsPtr->getCwdProc;
cd = proc2(oldcd);
if (cd != oldcd) {
/*
* Call getCwdProc() and store the resulting internal handle to
* compare things with it later. This might might not be
* exactly the same string as that of the fully normalized
* pathname. For example, for the Windows internal handle the
* separator is the backslash character. On Unix it might well
* be true that the internal handle is the fully normalized
* pathname and one could simply use:
* cd = Tcl_FSGetNativePath(pathPtr);
* but this can't be guaranteed in the general case. In fact,
|
|
|
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
|
TclFSGetCwdProc2 *proc2 = (TclFSGetCwdProc2 *) fsPtr->getCwdProc;
cd = proc2(oldcd);
if (cd != oldcd) {
/*
* Call getCwdProc() and store the resulting internal handle to
* compare things with it later. This might not be
* exactly the same string as that of the fully normalized
* pathname. For example, for the Windows internal handle the
* separator is the backslash character. On Unix it might well
* be true that the internal handle is the fully normalized
* pathname and one could simply use:
* cd = Tcl_FSGetNativePath(pathPtr);
* but this can't be guaranteed in the general case. In fact,
|
| ︙ | | | ︙ | |
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
|
/*
* Determine which filesystem contains the temporary copy of the file.
*/
if (tvdlPtr->divertedFilesystem == NULL) {
/*
* Use the function for the native filsystem, which works works even at
* this late stage.
*/
TclpDeleteFile(tvdlPtr->divertedFileNativeRep);
NativeFreeInternalRep(tvdlPtr->divertedFileNativeRep);
} else {
/*
|
|
|
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
|
/*
* Determine which filesystem contains the temporary copy of the file.
*/
if (tvdlPtr->divertedFilesystem == NULL) {
/*
* Use the function for the native filsystem, which works even at
* this late stage.
*/
TclpDeleteFile(tvdlPtr->divertedFileNativeRep);
NativeFreeInternalRep(tvdlPtr->divertedFileNativeRep);
} else {
/*
|
| ︙ | | | ︙ | |
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
|
*----------------------------------------------------------------------
*/
void *
Tcl_FindSymbol(
Tcl_Interp *interp, /* The relevant interpreter. */
Tcl_LoadHandle loadHandle, /* A handle for the loaded object. */
const char *symbol) /* The name name of the symbol to resolve. */
{
return loadHandle->findSymbolProcPtr(interp, loadHandle, symbol);
}
/*
*----------------------------------------------------------------------
*
|
|
|
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
|
*----------------------------------------------------------------------
*/
void *
Tcl_FindSymbol(
Tcl_Interp *interp, /* The relevant interpreter. */
Tcl_LoadHandle loadHandle, /* A handle for the loaded object. */
const char *symbol) /* The name of the symbol to resolve. */
{
return loadHandle->findSymbolProcPtr(interp, loadHandle, symbol);
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | | | ︙ | |
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
|
/* If not NULL, a place to store a pointer to
* the filesystem for this pathname when it is
* an absolute pathname. */
Tcl_Size *driveNameLengthPtr,
/* If not NULL, a place to store the length of
* the volume name if the pathname is absolute. */
Tcl_Obj **driveNameRef) /* If not NULL, a place to store a pointer to
* an object having its its refCount already
* incremented, and contining the name of the
* volume if the pathname is absolute. */
{
FilesystemRecord *fsRecPtr;
Tcl_PathType type = TCL_PATH_RELATIVE;
/*
* Determine whether the given pathname is an absolute pathname on some
* filesystem other than the native filesystem.
*/
fsRecPtr = FsGetFirstFilesystem();
Claim();
while (fsRecPtr != NULL) {
/*
* Skip the the native filesystem because otherwise some of the tests
* in the Tcl testsuite might fail because some of the tests
* artificially change the current platform (between win, unix) but the
* list of volumes obtained by calling fsRecPtr->fsPtr->listVolumesProc
* reflects the current (real) platform only. In particular, on Unix
* '/' matchs the beginning of certain absolute Windows pathnames
* starting '//' and those tests go wrong.
*
|
|
|
|
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
|
/* If not NULL, a place to store a pointer to
* the filesystem for this pathname when it is
* an absolute pathname. */
Tcl_Size *driveNameLengthPtr,
/* If not NULL, a place to store the length of
* the volume name if the pathname is absolute. */
Tcl_Obj **driveNameRef) /* If not NULL, a place to store a pointer to
* an object having its refCount already
* incremented, and contining the name of the
* volume if the pathname is absolute. */
{
FilesystemRecord *fsRecPtr;
Tcl_PathType type = TCL_PATH_RELATIVE;
/*
* Determine whether the given pathname is an absolute pathname on some
* filesystem other than the native filesystem.
*/
fsRecPtr = FsGetFirstFilesystem();
Claim();
while (fsRecPtr != NULL) {
/*
* Skip the native filesystem because otherwise some of the tests
* in the Tcl testsuite might fail because some of the tests
* artificially change the current platform (between win, unix) but the
* list of volumes obtained by calling fsRecPtr->fsPtr->listVolumesProc
* reflects the current (real) platform only. In particular, on Unix
* '/' matchs the beginning of certain absolute Windows pathnames
* starting '//' and those tests go wrong.
*
|
| ︙ | | | ︙ | |
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
|
}
break;
}
}
Tcl_DecrRefCount(thisFsVolumes);
if (type == TCL_PATH_ABSOLUTE) {
/*
* No need to to examine additional filesystems.
*/
break;
}
}
}
fsRecPtr = fsRecPtr->nextPtr;
|
|
|
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
|
}
break;
}
}
Tcl_DecrRefCount(thisFsVolumes);
if (type == TCL_PATH_ABSOLUTE) {
/*
* No need to examine additional filesystems.
*/
break;
}
}
}
fsRecPtr = fsRecPtr->nextPtr;
|
| ︙ | | | ︙ | |
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
|
}
/*
*---------------------------------------------------------------------------
*
* Tcl_FSCopyDirectory --
*
* If both pathnames correspond to the the same filesystem, calls
* 'copyDirectoryProc' of that filesystem.
*
* Results:
* A standard Tcl return code, or -1 if no 'copyDirectoryProc' is found.
*
* Side effects:
* A directory may be copied. POSIX error 'EXDEV' is set if no
|
|
|
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
|
}
/*
*---------------------------------------------------------------------------
*
* Tcl_FSCopyDirectory --
*
* If both pathnames correspond to the same filesystem, calls
* 'copyDirectoryProc' of that filesystem.
*
* Results:
* A standard Tcl return code, or -1 if no 'copyDirectoryProc' is found.
*
* Side effects:
* A directory may be copied. POSIX error 'EXDEV' is set if no
|
| ︙ | | | ︙ | |
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
|
int
Tcl_FSRemoveDirectory(
Tcl_Obj *pathPtr, /* The pathname of the directory to be removed. */
int recursive, /* If zero, removes only an empty directory.
* Otherwise, removes the directory and all its
* contents. */
Tcl_Obj **errorPtr) /* If not NULL and an error occurs, stores a
* place to store a a pointer to a new
* object having a refCount of 1 and containing
* the name of the file that produced an error. */
{
const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr == NULL) {
Tcl_SetErrno(ENOENT);
|
|
|
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
|
int
Tcl_FSRemoveDirectory(
Tcl_Obj *pathPtr, /* The pathname of the directory to be removed. */
int recursive, /* If zero, removes only an empty directory.
* Otherwise, removes the directory and all its
* contents. */
Tcl_Obj **errorPtr) /* If not NULL and an error occurs, stores a
* place to store a pointer to a new
* object having a refCount of 1 and containing
* the name of the file that produced an error. */
{
const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr == NULL) {
Tcl_SetErrno(ENOENT);
|
| ︙ | | | ︙ | |