Skip to content

Export-PSGraph -showgraph and destination path problem #110

@akvarius

Description

@akvarius

Hi,
it seems Export-PSGraph does not support quoted folders/filenames in Windows, for instance when users home folder contains space, for instance Firstname Lastname or Project Files.

Maybe this is the cause of #104 (comment)

Let's say $x already have a structure, and we want to create a graphics file, this works, and I used verbose to show the path being used by default:

PS C:\> $x | Export-PSGraph -Verbose
VERBOSE: Processing standard input
VERBOSE:   Creating temporary path to save graph
VERBOSE: Tryig to set OutputFormat to match file extension
VERBOSE: Walking parameter mapping
VERBOSE:  Arguments: -oC:\Users\Firstname Lastname\AppData\Local\Temp\ef0lfemt.zxu.png -Tpng
    Directory: C:\Users\Firstname Lastname\AppData\Local\Temp
Mode                 LastWriteTime         Length Name                                                                                                      
----                 -------------         ------ ----                                                                                                      
-a----        12.12.2022     22.54           5445 ef0lfemt.zxu.png  

If I want to display the result in the same operation, this fails:

PS C:\> $x | Export-PSGraph -Verbose -ShowGraph
VERBOSE: Processing standard input
VERBOSE:   Creating temporary path to save graph
VERBOSE: Tryig to set OutputFormat to match file extension
VERBOSE: Walking parameter mapping
VERBOSE:  Arguments: -Tpng -oC:\Users\Firstname Lastname\AppData\Local\Temp\4imuadue.htc.png
VERBOSE: Launching C:\Users\Firstname Lastname\AppData\Local\Temp\4imuadue.htc.png
Export-PSGraph : The term 'C:\Users\Firstname' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the n
ame, or if a path was included, verify that the path is correct and try again.
At line:1 char:6
+ $x | Export-PSGraph -Verbose -ShowGraph
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Firstname:String) [Export-PSGraph], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Export-PSGraph

This happens because destination path is missing quotes.

I can use a folder without spaces -DestinationPath "C:\graphviz\test.png",
or start the file in a separate statement after exporting, but if I really want another destination with space in the path I must move it after exporting, also requiring a separate statement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions