mirror of
https://github.com/zontreck/NBTEditor
synced 2024-11-21 05:25:54 -07:00
Start to add an appimage script
This commit is contained in:
parent
10f18668de
commit
b2747c7610
4 changed files with 80 additions and 25 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -29,3 +29,6 @@ doc/api/
|
|||
out
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
AppDir
|
||||
appimage-build
|
50
AppImageBuilder.yml
Normal file
50
AppImageBuilder.yml
Normal file
|
@ -0,0 +1,50 @@
|
|||
# appimage-builder recipe see https://appimage-builder.readthedocs.io for details
|
||||
version: 1
|
||||
script:
|
||||
- rm -rf AppDir || true
|
||||
- flutter pub get
|
||||
- rm -rf build || true
|
||||
- flutter build linux
|
||||
- cp -r build/linux/x64/release/bundle AppDir
|
||||
- mkdir -p AppDir/usr/share/icons/hicolor/64x64/apps
|
||||
- cp Icons/PNG/nbteditor.png AppDir/usr/share/icons/hicolor/64x64/apps/
|
||||
AppDir:
|
||||
path: AppDir
|
||||
app_info:
|
||||
id: dev.zontreck.nbteditor
|
||||
name: NBT Editor
|
||||
icon: nbteditor
|
||||
version: latest
|
||||
exec: nbteditor
|
||||
exec_args: $@
|
||||
pacman:
|
||||
include: []
|
||||
exclude: []
|
||||
files:
|
||||
include:
|
||||
- /lib64/ld-linux-x86-64.so.2
|
||||
exclude:
|
||||
- usr/share/man
|
||||
- usr/share/doc/*/README.*
|
||||
- usr/share/doc/*/changelog.*
|
||||
- usr/share/doc/*/NEWS.*
|
||||
- usr/share/doc/*/TODO.*
|
||||
test:
|
||||
fedora-30:
|
||||
image: appimagecrafters/tests-env:fedora-30
|
||||
command: ./AppRun
|
||||
debian-stable:
|
||||
image: appimagecrafters/tests-env:debian-stable
|
||||
command: ./AppRun
|
||||
archlinux-latest:
|
||||
image: appimagecrafters/tests-env:archlinux-latest
|
||||
command: ./AppRun
|
||||
centos-7:
|
||||
image: appimagecrafters/tests-env:centos-7
|
||||
command: ./AppRun
|
||||
ubuntu-xenial:
|
||||
image: appimagecrafters/tests-env:ubuntu-xenial
|
||||
command: ./AppRun
|
||||
AppImage:
|
||||
arch: x86_64
|
||||
update-information: guess
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:file_picker/file_picker.dart';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_file_dialog/flutter_file_dialog.dart';
|
||||
import 'package:flutter_treeview/flutter_treeview.dart';
|
||||
import 'package:libac_dart/nbt/NbtIo.dart';
|
||||
import 'package:libac_dart/nbt/SnbtIo.dart';
|
||||
|
@ -87,10 +89,9 @@ class EditorState extends State<Editor> {
|
|||
leading: const Icon(Icons.folder),
|
||||
subtitle: const Text("Open an existing NBT Document for editing"),
|
||||
onTap: () async {
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles();
|
||||
String? filePath;
|
||||
if (result != null) {
|
||||
filePath = result.files.single.path;
|
||||
String? filePath = await FlutterFileDialog.pickFile(
|
||||
params: OpenFileDialogParams());
|
||||
if (filePath != null) {
|
||||
// Do something with the selected file path
|
||||
print('Selected file path: $filePath');
|
||||
} else {
|
||||
|
@ -129,16 +130,6 @@ class EditorState extends State<Editor> {
|
|||
image: AssetImage("Icons/PNG/nbteditor.png"),
|
||||
),
|
||||
onTap: () async {
|
||||
// Prompt for where to save
|
||||
print("Begin picking file to save to");
|
||||
String? filePath = await FilePicker.platform
|
||||
.saveFile(dialogTitle: "Where do you want to save the file?");
|
||||
if (filePath == null) {
|
||||
print("No file selected");
|
||||
return;
|
||||
}
|
||||
print(filePath);
|
||||
|
||||
var result = await showDialog(
|
||||
context: context,
|
||||
builder: (builder) {
|
||||
|
@ -159,14 +150,25 @@ class EditorState extends State<Editor> {
|
|||
);
|
||||
});
|
||||
|
||||
Uint8List u8l = Uint8List(0);
|
||||
if (result == null) {
|
||||
// Save uncompressed
|
||||
NbtIo.write(
|
||||
filePath, controller.children[0].data as CompoundTag);
|
||||
u8l = await NbtIo.writeToStream(
|
||||
controller.children[0].data as CompoundTag);
|
||||
} else {
|
||||
NbtIo.writeCompressed(
|
||||
filePath, controller.children[0].data as CompoundTag);
|
||||
u8l = await NbtIo.writeToStreamCompressed(
|
||||
controller.children[0].data as CompoundTag);
|
||||
}
|
||||
// Prompt for where to save
|
||||
print("Begin picking file to save to");
|
||||
var params = await SaveFileDialogParams(data: u8l);
|
||||
var filePath = await FlutterFileDialog.saveFile(params: params);
|
||||
|
||||
if (filePath == null) {
|
||||
print("No file selected");
|
||||
return;
|
||||
}
|
||||
print(filePath);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
|
@ -178,8 +180,8 @@ class EditorState extends State<Editor> {
|
|||
onTap: () async {
|
||||
// Prompt for where to save
|
||||
print("Begin picking file to save to");
|
||||
String? filePath = await FilePicker.platform
|
||||
.saveFile(dialogTitle: "Where do you want to save the file?");
|
||||
String? filePath = await FlutterFileDialog.saveFile(
|
||||
params: SaveFileDialogParams());
|
||||
if (filePath == null) {
|
||||
print("No file selected");
|
||||
return;
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
name: nbteditor
|
||||
description: A Minecraft NBT Editor written in Flutter
|
||||
publish_to: 'none'
|
||||
version: 1.0722.24+1506
|
||||
version: 1.0722.24+1907
|
||||
|
||||
|
||||
environment:
|
||||
sdk: '>=3.1.5 <4.0.0'
|
||||
|
||||
dependencies:
|
||||
file_picker: ^8.0.6
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_code_editor: ^0.3.2
|
||||
flutter_file_dialog: ^3.0.2
|
||||
flutter_highlight: ^0.7.0
|
||||
flutter_treeview: ^1.0.7+1
|
||||
libac_dart:
|
||||
hosted: https://git.zontreck.com/api/packages/AriasCreations/pub/
|
||||
version: 1.2.072224+0449
|
||||
version: 1.2.072224+1906
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in a new issue