Skip to content
Tcl Source Code View Ticket
Login

View Ticket

file attributes on MacOS doesn't do UTF->External conversion

Closed / Fixed218946ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:08:28
OriginalBugID: 2869 Bug
Version: 8.2
SubmitDate: '1999-09-23'
LastModified: '1999-09-24'
Severity: SER
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: Macintosh
OSVersion: 8.6
Machine: Power PC
FixedDate: '1999-09-24'
FixedInVersion: 8.2.1
ClosedDate: '2000-10-25'


Name:

vince darley


ReproducibleScript:

Any use of file attributes with a filename which contains chars > 128

    will fail since the file can't be found.  This is because Tcl doesn't

    convert the name from UTF to native.


Patch:

*** tcl8.2/mac/tclMacFCmd.cWed Sep 22 12:51:48 1999

--- tcl8.2orig/mac/tclMacFCmd.cTue May 11 01:12:00 1999

***************

*** 1194,1210 ****

  GetFileFinderAttributes(

      Tcl_Interp *interp,/* The interp to report errors with. */

      int objIndex,/* The index of the attribute option. */

!     CONST char *fileName,/* The name of the file (UTF-8). */

      Tcl_Obj **attributePtrPtr)/* A pointer to return the object with. */

  {

      OSErr err;

      FSSpec fileSpec;

      FInfo finfo;

!     Tcl_DString pathString;

! 

!     Tcl_UtfToExternalDString(NULL, path, -1, &pathString);

!     err = FSpLocationFromPath(Tcl_DStringLength(&pathString), Tcl_DStringValue(&pathString), &fileSpec);

!     Tcl_DStringFree(&pathString);


      if (err == noErr) {

      err = FSpGetFInfo(&fileSpec, &finfo);

--- 1194,1207 ----

  GetFileFinderAttributes(

      Tcl_Interp *interp,/* The interp to report errors with. */

      int objIndex,/* The index of the attribute option. */

!     CONST char *fileName,/* The name of the file. */

      Tcl_Obj **attributePtrPtr)/* A pointer to return the object with. */

  {

      OSErr err;

      FSSpec fileSpec;

      FInfo finfo;

!     

!     err = FSpLocationFromPath(strlen(fileName), fileName, &fileSpec);


      if (err == noErr) {

      err = FSpGetFInfo(&fileSpec, &finfo);

***************

*** 1272,1288 ****

  GetFileReadOnly(

      Tcl_Interp *interp,/* The interp to report errors with. */

      int objIndex,/* The index of the attribute. */

!     CONST char *fileName,/* The name of the file (UTF-8). */

      Tcl_Obj **readOnlyPtrPtr)/* A pointer to return the object with. */

  {

      OSErr err;

      FSSpec fileSpec;

      CInfoPBRec paramBlock;

!     Tcl_DString pathString;

! 

!     Tcl_UtfToExternalDString(NULL, path, -1, &pathString);

!     err = FSpLocationFromPath(Tcl_DStringLength(&pathString), Tcl_DStringValue(&pathString), &fileSpec);

!     Tcl_DStringFree(&pathString);


      if (err == noErr) {

      if (err == noErr) {

--- 1269,1282 ----

  GetFileReadOnly(

      Tcl_Interp *interp,/* The interp to report errors with. */

      int objIndex,/* The index of the attribute. */

!     CONST char *fileName,/* The name of the file. */

      Tcl_Obj **readOnlyPtrPtr)/* A pointer to return the object with. */

  {

      OSErr err;

      FSSpec fileSpec;

      CInfoPBRec paramBlock;

!     

!     err = FSpLocationFromPath(strlen(fileName), fileName, &fileSpec);


      if (err == noErr) {

      if (err == noErr) {

***************

*** 1336,1352 ****

  SetFileFinderAttributes(

      Tcl_Interp *interp,/* The interp to report errors with. */

      int objIndex,/* The index of the attribute. */

!     CONST char *fileName,/* The name of the file (UTF-8). */

      Tcl_Obj *attributePtr)/* The command line object. */

  {

      OSErr err;

      FSSpec fileSpec;

      FInfo finfo;

!     Tcl_DString pathString;

! 

!     Tcl_UtfToExternalDString(NULL, path, -1, &pathString);

!     err = FSpLocationFromPath(Tcl_DStringLength(&pathString), Tcl_DStringValue(&pathString), &fileSpec);

!     Tcl_DStringFree(&pathString);


      if (err == noErr) {

      err = FSpGetFInfo(&fileSpec, &finfo);

--- 1330,1343 ----

  SetFileFinderAttributes(

      Tcl_Interp *interp,/* The interp to report errors with. */

      int objIndex,/* The index of the attribute. */

!     CONST char *fileName,/* The name of the file. */

      Tcl_Obj *attributePtr)/* The command line object. */

  {

      OSErr err;

      FSSpec fileSpec;

      FInfo finfo;

!     

!     err = FSpLocationFromPath(strlen(fileName), fileName, &fileSpec);


      if (err == noErr) {

      err = FSpGetFInfo(&fileSpec, &finfo);

***************

*** 1427,1444 ****

  SetFileReadOnly(

      Tcl_Interp *interp,/* The interp to report errors with. */

      int objIndex,/* The index of the attribute. */

!     CONST char *fileName,/* The name of the file (UTF-8). */

      Tcl_Obj *readOnlyPtr)/* The command line object. */

  {

      OSErr err;

      FSSpec fileSpec;

      HParamBlockRec paramBlock;

      int hidden;

!     Tcl_DString pathString;

! 

!     Tcl_UtfToExternalDString(NULL, path, -1, &pathString);

!     err = FSpLocationFromPath(Tcl_DStringLength(&pathString), Tcl_DStringValue(&pathString), &fileSpec);

!     Tcl_DStringFree(&pathString);


      if (err == noErr) {

      if (Tcl_GetBooleanFromObj(interp, readOnlyPtr, &hidden) != TCL_OK) {

--- 1418,1432 ----

  SetFileReadOnly(

      Tcl_Interp *interp,/* The interp to report errors with. */

      int objIndex,/* The index of the attribute. */

!     CONST char *fileName,/* The name of the file. */

      Tcl_Obj *readOnlyPtr)/* The command line object. */

  {

      OSErr err;

      FSSpec fileSpec;

      HParamBlockRec paramBlock;

      int hidden;

!     

!     err = FSpLocationFromPath(strlen(fileName), fileName, &fileSpec);


      if (err == noErr) {

      if (Tcl_GetBooleanFromObj(interp, readOnlyPtr, &hidden) != TCL_OK) {


PatchFiles:

tclMacFCmd.c




Fix applied to 8.2.1. 
-- 09/24/1999 hobbs
welch Closed ticket [218946ffff]. [History diff]2000-10-26 08:32:14
dgp Ticket [218946ffff]: 3 changes [History diff]2001-04-19 03:32:02
Log in (anonymous is fine) to add a comment.