speedata / publisher

speedata Publisher - a professional database Publishing system
https://www.speedata.de/
GNU Affero General Public License v3.0
296 stars 36 forks source link

directory separator in Windows #390

Closed pr-apes closed 2 years ago

pr-apes commented 2 years ago

@pgundlach,

I have the following sample:

<Layout xmlns="urn:speedata.de:2009/publisher/en"
  xmlns:sd="urn:speedata:2009/publisher/functions/en">

  <Record element="data">
    <SetVariable variable="myfile" select="$external_pdfdoc"/>
    <Loop select="sd:number-of-pages($myfile)" variable="page">
      <PlaceObject column="0mm" row="0mm">
        <Image file="{$myfile}" width="210mm" page="{$page}"/>
      </PlaceObject>
      <ClearPage/>
    </Loop>
  </Record>

</Layout>

With the common invocation sp --autoopen, I have the following possibilities (using Windows):

  1. -v external_pdfdoc=../doc-100.pdf: included pages.
  2. -v external_pdfdoc=..\doc-100.pdf pages not included.
  3. -v external_pdfdoc=%USERPROFILE%/Desktop/doc-100.pdf pages not included.
  4. -v external_pdfdoc=%USERPROFILE%\Desktop\doc-100.pdf pages not included.
  5. -v external_pdfdoc=c:/Users/username/Desktop/doc-100.pdf included pages.
  6. -v external_pdfdoc=c:\Users\username\Desktop\doc-100.pdf pages not included.

From https://doc.speedata.de/publisher/en/filenames/, I thought that options 4 and 6 would include the pages.

Am I missing something or is this the way Publisher behaves?

Many thanks for your help.

pgundlach commented 2 years ago

How do you start the sp.exe program? On a command line? I assume that the backslashes must be doubled (but this should be documented)

pr-apes commented 2 years ago

Ok, I get it now.

pr-apes commented 2 years ago

So, as a general rule, when backslashes are used to specify Windows paths, they have to be escaped as \\, don’t they?

pgundlach commented 2 years ago

It depends on where you use them. Within the layout or data files, one backslash should be fine. If provided at startup time from the command line, it should be doubled (so I assume).

pr-apes commented 2 years ago

Well, this is trial and error.

If I happened to have a more precise description when to escape backslashes, I would reopen the issue myself.

Many thanks for your help.