mirror of https://gitee.com/makejava/EasyCode.git
fix: 修复导出配置乱码并格式化输出
This commit is contained in:
parent
be02d792b5
commit
7e65744ef2
|
@ -25,7 +25,7 @@ public class ClipboardExportImportSettingsServiceImpl implements ExportImportSet
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exportConfig(SettingsStorageDTO settingsStorage) {
|
public void exportConfig(SettingsStorageDTO settingsStorage) {
|
||||||
String json = JSON.toJson(settingsStorage);
|
String json = JSON.toJsonByFormat(settingsStorage);
|
||||||
CopyPasteManager.getInstance().setContents(new TextTransferable(json));
|
CopyPasteManager.getInstance().setContents(new TextTransferable(json));
|
||||||
Messages.showInfoMessage("Config info success write to clipboard!", GlobalDict.TITLE_INFO);
|
Messages.showInfoMessage("Config info success write to clipboard!", GlobalDict.TITLE_INFO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本地文件导入导出设置服务实现
|
* 本地文件导入导出设置服务实现
|
||||||
|
@ -52,7 +53,7 @@ public class LocalFileExportImportSettingsServiceImpl implements ExportImportSet
|
||||||
FileUtil.createIfDoesntExist(file);
|
FileUtil.createIfDoesntExist(file);
|
||||||
WriteCommandAction.runWriteCommandAction(ProjectUtils.getCurrProject(), () -> {
|
WriteCommandAction.runWriteCommandAction(ProjectUtils.getCurrProject(), () -> {
|
||||||
try {
|
try {
|
||||||
byte[] bytes = JSON.toJson(settingsStorage).getBytes();
|
byte[] bytes = JSON.toJsonByFormat(settingsStorage).getBytes(StandardCharsets.UTF_8);
|
||||||
VirtualFile virtualFile = VfsUtil.findFileByIoFile(file, true);
|
VirtualFile virtualFile = VfsUtil.findFileByIoFile(file, true);
|
||||||
if (virtualFile != null) {
|
if (virtualFile != null) {
|
||||||
virtualFile.setBinaryContent(bytes);
|
virtualFile.setBinaryContent(bytes);
|
||||||
|
|
Loading…
Reference in New Issue