function stubPlainTextFiles(resourceRoots, destination) {
  _.forEach(resourceRoots, function (resource) {
    // Replace the webstorm file:// scheme with an absolute file path
    var filePath = resource.replace('file://$PROJECT_DIR$', destination);
    filePath = filePath.replace('.idea/', '');
    // Extract the location from the file path to recursively create it if it doesn't exist.
    var location = filePath.replace(/[^\/]*$/, '');

    if (!fs.existsSync(location))
      mkdir('-p', location);

    if (!fs.existsSync(filePath))
      fs.writeFileSync(filePath, ' ', 'utf8');
  });
}
function stubPlainTextFiles(resourceRoots, destination) {
  _.forEach(resourceRoots, function (resource) {
    // Replace the webstorm file:// scheme with an absolute file path
    var filePath = resource.replace('file://$PROJECT_DIR$', destination);
    filePath = filePath.replace('.idea/', '');
    // Extract the location from the file path to recursively create it if it doesn't exist.
    var location = filePath.replace(/[^\/]*$/, '');

    if (!fs.existsSync(location))
      mkdir('-p', location);

    if (!fs.existsSync(filePath))
      fs.writeFileSync(filePath, ' ', 'utf8');
  });
}
function stubPlainTextFiles ( resourceRoots , destination ) { _ . forEach ( resourceRoots , function ( resource ) { // Replace the webstorm file:// scheme with an absolute file path var filePath = resource . replace ( 'file://$PROJECT_DIR$' , destination ) ; filePath = filePath . replace ( '.idea/' , '' ) ; // Extract the location from the file path to recursively create it if it doesn't exist. var location = filePath . replace ( / [^\/]*$ / , '' ) ; if ( ! fs . existsSync ( location ) ) mkdir ( '-p' , location ) ; if ( ! fs . existsSync ( filePath ) ) fs . writeFileSync ( filePath , ' ' , 'utf8' ) ; } ) ; }
When generating the .idea project WebStorm will remove any plain text files specified
on first open if they do not exist.
For example this lets files from a build be marked as plain text before they exist
by stubbing an empty file at their expected position.
@param resourceRoots
@param destination
When generating the . idea project WebStorm will remove any plain text files specified on first open if they do not exist . For example this lets files from a build be marked as plain text before they exist by stubbing an empty file at their expected position .