瀏覽代碼

Cope with leading asterisk, and missing dot

Matt Clarkson 11 年之前
父節點
當前提交
0fe540df9e
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      Libs/CommandLineModules/Frontend/QtGui/Resources/ctkCmdLineModuleXmlToQtUi.xsl

+ 8 - 2
Libs/CommandLineModules/Frontend/QtGui/Resources/ctkCmdLineModuleXmlToQtUi.xsl

@@ -246,8 +246,14 @@
     <property name="nameFilters">
       <stringlist>
       <xsl:for-each select="tokenize(@fileExtensions, ',')">
-        <!-- Note: We add an asterisk at the start. If the asterisk is missing in the xml, you can't select anything. But if you end up with multiple asterisks, you can still select files. -->
-        <string>*<xsl:value-of select="normalize-space(.)"/></string>
+        <string>
+        <xsl:choose>
+          <xsl:when test="starts-with(normalize-space(.), '*')"><!-- do nothing --></xsl:when>
+          <xsl:when test="starts-with(normalize-space(.), '.')">*</xsl:when>
+          <xsl:otherwise>*.</xsl:otherwise>
+        </xsl:choose>
+        <xsl:value-of select="normalize-space(.)"/>
+        </string>
       </xsl:for-each>
       </stringlist>
     </property>