소스 검색

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>