Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Plugin and Companion App SDK
Viewing all articles
Browse latest Browse all 54282

How do I work around PIGetStr placing an invalid character in character buffer?

$
0
0

In an Export plug-in, I need to read in the destination file path from scripting parameters.  Often, the character at exportPath[0] is junk and not an actual part of the path (hence the check).  Recently, this junk has actually been alphanumeric characters.  I can write a more accurate platform-dependent workaround, but would prefer an actual solution.  As a note, this happens whenever I use PIGetStr, not just in the case of reading filepaths.

 

Is there a standard way to handle this behavior?

 

Example:

 

case keyFilePath:

          {

                    Str255 exportPath;

                    PIGetStr(token, &exportPath);

                    byte offset = 0;

                    if(!isalpha(exportPath[0]))

                                   offset = 1;

                    strcpy_s((char*)gDestination, 256 - offset, (char*)exportPath + offset);

                    DescParams->playInfo = 0; //Don't pop dialog.

                    break;

          }

 

Result in exportPath:  Ec:\temp\assets\textures\brick_stacked_tile_01_SpecColor_gradients.dds

 

Expected:  c:\temp\assets\textures\brick_stacked_tile_01_SpecColor_gradients.dds


Viewing all articles
Browse latest Browse all 54282

Trending Articles