Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fix $env:TEMP to use the full path instead of the MSDOS 8.3 shortened path for Windows users with long usernames #168

Conversation

leojonathanoh
Copy link
Member

Previously, the value of $env:TEMP is, for a Windows user with a long username, something like C:\users\somelo~1 for an actual path like C:\users\somelongusername. This value causes problems with pandoc which does not recognize shortened paths.

Now, the full path of $env:TEMP is resolved. This should fix the script for users with long usernames (anything more than 8 characters).

Useful links:

Fixes #167

…ortened path for Windows users with long usernames

Previously, the value of `$env:TEMP` is, for a Windows user with a long username, something like `C:\users\somelo~1` for an actual path like `C:\users\somelongusername`. This value causes problems with `pandoc` which does not recognize shortened paths.

Now, the full path of `$env:TEMP` is resolved. This should fix the script for users with long usernames (anything more than 8 characters).

Useful links:
- https://superuser.com/questions/529400/how-does-progra1-path-notation-work
- https://web.archive.org/web/20131206010029/http://support.microsoft.com/kb/142982
- https://superuser.com/questions/348079/how-can-i-find-the-short-path-of-a-windows-directory-file
- https://superuser.com/questions/1524767/powershell-uses-the-short-8-3-form-for-envtemp

Fixes #167
@leojonathanoh leojonathanoh force-pushed the fix/fix-env-temp-to-use-the-full-path-instead-of-the-msdos-8.3-shortened-path-for-windows-users-with-long-usernames branch from fbe6511 to 3d41422 Compare August 3, 2023 05:21
@leojonathanoh leojonathanoh modified the milestones: v2.21.1, v2.22.0 Aug 3, 2023
@med44600
Copy link

med44600 commented Aug 3, 2023

Hi, Thanks for your answers.
I rapidly check the 2 first uses with pandoc.exe and get these errors.
`PS C:\Users\MédéricGUERIN\Downloads\ConvertOneNote2MarkDown-master\ConvertOneNote2MarkDown-master> pandoc.exe -f docx -t markdown_mmd-simple_tables-multiline_tables-grid_tables+pipe_tables+task_lists-mmd_link_attributes-raw_html -i c:\notes\Reprise\docx{76279337-9B48-0B09-34AF-30DA87D5B196}{1}{E185189248259008087511978443734194607593311}-1662474788.docx -o c:\notes\Reprise\Nouvelle-section-1\6-9-2022---Expert-comptable.md --wrap=none --markdown-headings=atx --extract-media=C:/Users/MDRICG~1/AppData/Local/Temp/Reprise/2023-08-02-18-16-42-0695980
Au caractère Ligne:1 : 166

  • ... _link_attributes-raw_html -i c:\notes\Reprise\docx{76279337-9B48-0B0 ...
  •                                                              ~
    

Vous devez indiquer une expression de valeur après l’opérateur « - ».
Au caractère Ligne:1 : 166

  • ... i c:\notes\Reprise\docx{76279337-9B48-0B09-34AF-30DA87D5B196}{1}{E18 ...
  •                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Jeton inattendu « 9B48-0B09-34AF-30DA87D5B196 » dans l’expression ou l’instruction.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression

PS C:\Users\MédéricGUERIN\Downloads\ConvertOneNote2MarkDown-master\ConvertOneNote2MarkDown-master> pandoc.exe -f docx -t markdown_mmd-simple_tables-multiline_tables-grid_tables+pipe_tables+task_lists-mmd_link_attributes-raw_html -i c:\notes\Reprise\docx{76279337-9B48-0B09-34AF-30DA87D5B196}{1}{E185189248259008087511978443734194607593311}-1662474788.docx -o c:\notes\Reprise\Nouvelle-section-1\6-9-2022---Expert-comptable.md --wrap=none --markdown-headings=atx --extract-media=C:/notes
Au caractère Ligne:1 : 166

  • ... _link_attributes-raw_html -i c:\notes\Reprise\docx{76279337-9B48-0B0 ...
  •                                                              ~
    

Vous devez indiquer une expression de valeur après l’opérateur « - ».
Au caractère Ligne:1 : 166

  • ... i c:\notes\Reprise\docx{76279337-9B48-0B09-34AF-30DA87D5B196}{1}{E18 ...
  •                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Jeton inattendu « 9B48-0B09-34AF-30DA87D5B196 » dans l’expression ou l’instruction.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
`
I tried immedialtly #168 and get back :)

@leojonathanoh
Copy link
Member Author

leojonathanoh commented Aug 4, 2023

As discussed here and in #167, the source of the error in #167 was not due to pandoc not being able to parse MSDOS 8.3 shortened paths in --extract-media. Pandoc does recognize shortened paths.

Hence, this PR does not qualify as a fix for #167. But it may be an enhancement for readability and understandability sake whem full paths are used instead of shortened paths. #173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to Convert ... because specified file doesn't exists
2 participants