gpt4 book ai didi

java - 插件: Best way to safe a file in a project structure?

转载 作者:行者123 更新时间:2023-12-02 08:43:46 26 4
gpt4 key购买 nike

我在 IntelliJ IDEA 中编写了一个小型 Java 插件。这个插件允许我创建一个 yaml 文件。

我想使用 doOKAction 将其保存在我的项目结构中功能。

如果我对路径进行硬编码,它就会起作用。但如果我在另一台计算机上运行我的插件,它将无法工作。 (当然)

我会使用:

Path root = Paths.get(".").normalize().toAbsolutePath();

但这不起作用...

因为该插件不包含在当前的项目结构中,我会得到这样的东西:

"C:\Users\**\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.idea\ideaIC\2019.3.2\b911671d7501d9fd63cea3eee8287d8ceb4113c6\ideaIC-2019.3.2\bin ..."

如果有办法的话,在项目结构中的某个位置存储文件的最佳方法是什么?

最佳答案

参见https://www.jetbrains.org/intellij/sdk/docs/reference_guide/project_model/project.html关于如何获取当前项目结构设置中的路径。

关于java - 插件: Best way to safe a file in a project structure?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61216515/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com