|
From: <cre...@us...> - 2006-08-19 18:34:23
|
Revision: 1481 Author: creecode Date: 2006-08-19 11:34:18 -0700 (Sat, 19 Aug 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1481&view=rev Log Message: ----------- make function pathtofilespec, work with paths that have / ( forward slash ) as part of a folder or file name. Modified Paths: -------------- Frontier/branches/FSRef_Migration/Common/source/filepath.c Modified: Frontier/branches/FSRef_Migration/Common/source/filepath.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/filepath.c 2006-08-12 02:57:56 UTC (rev 1480) +++ Frontier/branches/FSRef_Migration/Common/source/filepath.c 2006-08-19 18:34:18 UTC (rev 1481) @@ -255,7 +255,7 @@ boolean pathtofilespec ( bigstring bspath, ptrfilespec fs ) { // - // 2006-08-11 creedon: for Mac, FSRef-ized + // 2006-08-19 creedon: for Mac, FSRef-ized // // 5.0d8 dmb: clear fs first thing // @@ -288,6 +288,7 @@ bigstring bs, bspathtmp; FSRef fsr; OSStatus status; + short ix = 1, ixslashpos = 0, slashpos [ 255 ]; copystring ( bspath, bspathtmp ); @@ -305,8 +306,14 @@ copystring ( bsfullpath, bs); + while ( scanstring ( '/', bs, &ix ) ) + slashpos [ ixslashpos++ ] = ix++; + stringreplaceall ( ':', '/', bs ); + while ( ixslashpos > 0 ) + setstringcharacter ( bs, slashpos [ --ixslashpos ] - 1, ':' ); + convertpstring ( bs ); status = FSPathMakeRef ( bs, &fsr, NULL ); @@ -327,10 +334,19 @@ /* emulate behaviour of FSSpec */ { + ix = 1; + ixslashpos = 0; + folderfrompath ( bsfullpath, bs ); + while ( scanstring ( '/', bs, &ix ) ) + slashpos [ ixslashpos++ ] = ix++; + stringreplaceall ( ':', '/', bs ); + while ( ixslashpos > 0 ) + setstringcharacter ( bs, slashpos [ --ixslashpos ] - 1, ':' ); + convertpstring ( bs ); status = FSPathMakeRef ( bs, &fsr, NULL ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |