Explorar o código

Fixed a bug in cif writer if a string token started with _

David Sehnal %!s(int64=6) %!d(string=hai) anos
pai
achega
439320934f
Modificáronse 2 ficheiros con 5 adicións e 5 borrados
  1. 1 1
      src/mol-io/writer/cif/encoder/text.ts
  2. 4 4
      src/servers/model/test.ts

+ 1 - 1
src/mol-io/writer/cif/encoder/text.ts

@@ -196,7 +196,7 @@ function writeChecked(builder: StringBuilder, val: string) {
         return false;
     }
 
-    let escape = false, escapeCharStart = '\'', escapeCharEnd = '\' ';
+    let escape = val.charCodeAt(0) === 95 /* _ */, escapeCharStart = '\'', escapeCharEnd = '\' ';
     let hasWhitespace = false;
     let hasSingle = false;
     let hasDouble = false;

+ 4 - 4
src/servers/model/test.ts

@@ -42,13 +42,13 @@ if (!fs.existsSync(outPath)) fs.mkdirSync(outPath);
 async function run() {
     try {
         // const testFile = '1crn.cif'
-        // const testFile = '1grm_updated.cif'
-        const testFile = 'C:/Projects/mol-star/molstar-proto/build/test/1grm_updated.cif'
+        const testFile = '1grm_updated.cif'
+        //const testFile = 'C:/Projects/mol-star/molstar-proto/build/test/1grm_updated.cif'
         const request = createJob({
-            entryId: testFile, //path.join(examplesPath, testFile),
+            entryId: path.join(examplesPath, testFile),
             queryName: 'full',
             queryParams: { },
-            options: { modelNums: [ 2, 3 ] }
+            // options: { modelNums: [ 2, 3 ] }
         });
         // const request = createJob({
         //     entryId: path.join(examplesPath, testFile),