mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
refactoring: introduce constant NAME_FILE for the .name file
This commit is contained in:
@@ -24,6 +24,7 @@ import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||
import com.intellij.openapi.project.impl.ProjectImpl;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -265,7 +266,7 @@ public abstract class RecentProjectsManagerBase implements PersistentStateCompon
|
||||
private static String getProjectName(String path) {
|
||||
final File file = new File(path);
|
||||
if (file.isDirectory()) {
|
||||
final File nameFile = new File(new File(path, Project.DIRECTORY_STORE_FOLDER), ".name");
|
||||
final File nameFile = new File(new File(path, Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE);
|
||||
if (nameFile.exists()) {
|
||||
try {
|
||||
final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(nameFile), "UTF-8"));
|
||||
|
||||
+2
-2
@@ -299,7 +299,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
|
||||
final VirtualFile ideaDir = baseDir.findChild(Project.DIRECTORY_STORE_FOLDER);
|
||||
if (ideaDir != null && ideaDir.isValid()) {
|
||||
final VirtualFile nameFile = ideaDir.findChild(".name");
|
||||
final VirtualFile nameFile = ideaDir.findChild(ProjectImpl.NAME_FILE);
|
||||
if (nameFile != null && nameFile.isValid()) {
|
||||
try {
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(nameFile.getInputStream(), "UTF-8"));
|
||||
@@ -549,7 +549,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
final VirtualFile baseDir = getProjectBaseDir();
|
||||
if (baseDir != null && baseDir.isValid()) {
|
||||
filesToSave.add(FileSystem.FILE_SYSTEM
|
||||
.createFile(new File(new File(baseDir.getPath(), Project.DIRECTORY_STORE_FOLDER), ".name").getPath()));
|
||||
.createFile(new File(new File(baseDir.getPath(), Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE).getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.project.impl.ProjectImpl");
|
||||
private static final String PLUGIN_SETTINGS_ERROR = "Plugin Settings Error";
|
||||
public static final String NAME_FILE = ".name";
|
||||
|
||||
private ProjectManagerImpl myManager;
|
||||
|
||||
@@ -342,7 +343,7 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
|
||||
if (baseDir != null && baseDir.isValid()) {
|
||||
final VirtualFile ideaDir = baseDir.findChild(DIRECTORY_STORE_FOLDER);
|
||||
if (ideaDir != null && ideaDir.isValid() && ideaDir.isDirectory()) {
|
||||
final File nameFile = new File(ideaDir.getPath(), ".name");
|
||||
final File nameFile = new File(ideaDir.getPath(), NAME_FILE);
|
||||
try {
|
||||
FileUtil.writeToFile(nameFile, getName().getBytes("UTF-8"), false);
|
||||
myOldName = null;
|
||||
|
||||
Reference in New Issue
Block a user