我的应用程序使用 Glade 文件并将数据缓存在 JSON 文件中。当我执行以下操作时,只要用户使用以下命令安装应用程序,一切都会正常工作ninja install
#Install cached JSON file
install_data(
join_paths('data', 'dataCache.json'),
install_dir: join_paths('myapp', 'resources')
)
#Install the user interface glade file
install_data(
join_paths('src', 'MainWindow.glade'),
install_dir: join_paths('myapp', 'resources')
)
Run Code Online (Sandbox Code Playgroud)
缺点是用户需要安装应用程序。我希望用户能够仅构建应用程序并ninja运行它,而无需安装它(如果他们不想在系统上安装它)。问题是当我这样做时
#Copy the cached JSON file to the build output directory
configure_file(input : join_paths('data', 'dataCache.json'),
output : join_paths('myapp', 'resources', 'dataCache.json'),
copy: true
)
#Copy the Glade file to the build output directory
configure_file(input : join_paths('src', 'MainWindow.glade'),
output : join_paths('myapp', 'resources', 'MainWindow.glade'),
copy: true
)
Run Code Online (Sandbox Code Playgroud)
我收到错误:输出文件名不得包含子目录。
有没有办法运行 …
我试图仅制作字符和数字的词法分析器,但收到错误消息,指出词法分析器未定义。我将来会将它用于文件,但现在我正在使用键盘输入进行测试。这是我的代码:
(require parser-tools/lex-sre)
(define simpleCharNumLexer
(lexer
[(:+ (:or (char-range #\a #\z) (char-range #\A #\Z)))
; =>
(cons `(ID ,(string->symbol lexeme))
(analyze input-port))]
[(:: (:? #\-) (:+ (char-range #\0 #\9)))
; =>
(cons `(INT ,(string->number lexeme))
(analyze input-port))]))
Run Code Online (Sandbox Code Playgroud)
这是错误: 词法分析器:未定义;无法引用未定义的标识符
我使用 DrRacket 6.1 和 Pretty Big 作为语言环境。我认为 lexer 是一个模块,但是我如何找到它或定义它?
我的构建系统使用介子,将我的应用程序所需的一些文件放在 AppDir 下的AppDir/usr/share/myapp/resources. 应用程序在运行时需要读取和写入这些文件。当我查看时,这些文件位于 AppDir 中,但是当生成 .AppImage 时,独立运行的可执行文件无法访问这些文件。将应用程序与桌面集成时,应用程序将安装在 中~/Applications,但它不包含这些文件。
ninja install以下是在不使用 AppImage ( )的情况下将应用程序安装到系统上时的外观可视化
usr
share
myapp
resources
MainWindow.glade
dataCache.json
Run Code Online (Sandbox Code Playgroud)
当我这样做时,DESTDIR=AppDir ninja install结构会像这样结束
AppDir
usr
share
myapp
resources
MainWindow.glade
dataCache.json
Run Code Online (Sandbox Code Playgroud)
当使用AppImageLauncher将应用程序 ( MyApp.AppImage ) 集成到用户桌面时,它仅将 AppImage 复制到 Applications 目录中。没有其他文件夹或文件。
编辑:我用来./linuxdeploy-x86_64.AppImage --appdir AppDir创建目录 AppDir。然后我用来DESTDIR=AppDir ninja install将应用程序安装到 AppDir,然后我用来./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage创建 AppImage
应用程序捆绑后,如何访问 AppDir 中的那些文件?或者如何使应用程序集成将这些文件复制到“应用程序”文件夹,以便应用程序可以在应用程序运行时访问它们?
当我使用此页面中的任何代码而不修改任何内容时:https://wiki.gnome.org/Projects/Vala/AsyncSamples
\n\n我总是得到:\nwarning: \xe2\x80\x98g_simple_async_result_new\xe2\x80\x99 is deprecated: Use \'g_task_new\' instead.
所以我继续建议使用GTask。然而,当我尝试在 Vala 中使用 GLib.Task 时,我在声明任务时陷入困境。因此,我没有在自己的代码中使用 GIO 的异步(因为它已被弃用),而是尝试使用 GLib.Task 来简单地使用 for 循环中的数字更新 Gtk 按钮的标签,这样代码如下所示:
\n\nusing Gtk;\nButton button;\n\npublic static int main (string[] args) {\n Gtk.init (ref args);\n\n var window = new Window ();\n window.title = "Count without blocking the UI";\n window.border_width = 10;\n window.window_position = WindowPosition.CENTER;\n window.set_default_size (350, 70);\n window.destroy.connect (Gtk.main_quit);\n button = new Button.with_label ("Start counting");\n button.clicked.connect (() => {\n GLib.Task task = new GLib.Task(button, new …Run Code Online (Sandbox Code Playgroud)