// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vfs.newvfs.persistent;

import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.nio.file.Path;

class PersistentFSPaths {
  @NonNls private static final String DEPENDENT_PERSISTENT_LIST_START_PREFIX = "vfs_enum_";
  static final String VFS_FILES_EXTENSION = System.getProperty("idea.vfs.files.extension", ".dat");

  @NotNull
  private final String myCachesDir;

  PersistentFSPaths(@NotNull String dir) {
    myCachesDir = dir;
  }

  @NotNull File getCorruptionMarkerFile() {
    return new File(new File(myCachesDir), "corruption.marker");
  }

  @NotNull File getVfsEnumBaseFile() {
    return new File(new File(myCachesDir), DEPENDENT_PERSISTENT_LIST_START_PREFIX);
  }

  @NotNull File getVfsEnumFile(@NotNull String enumName) {
    return new File(new File(myCachesDir), DEPENDENT_PERSISTENT_LIST_START_PREFIX + enumName + VFS_FILES_EXTENSION);
  }

  @NotNull Path getRootsFile() {
    assert FSRecords.ourStoreRootsSeparately;
    return new File(myCachesDir).getAbsoluteFile().toPath().resolve("roots" + VFS_FILES_EXTENSION);
  }
}

@@ -1126,25 +1126,16 @@
 %0A  %7D%0A%0A  
-@NotNull 
 Path get
@@ -1156,15 +1156,12 @@
     
-assert 
+if (
 FSRe
@@ -1193,13 +1193,9 @@
 tely
-;%0A   
+)
  ret
@@ -1283,18 +1283,40 @@
 EXTENSION);%0A
+    else return null;%0A
   %7D%0A%7D%0A

fix NPE