1
+ /*
2
+ * Copyright (c) 2024 (https://github.com/phase1geo/MosaicNote)
3
+ *
4
+ * This program is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2 of the License, or (at your option) any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public
15
+ * License along with this program; if not, write to the
16
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
+ * Boston, MA 02110-1301 USA
18
+ *
19
+ * Authored by: Trevor Williams <[email protected] >
20
+ */
21
+
22
+ public class TextBundle {
23
+
24
+ private MainWindow _win;
25
+
26
+ // -------------------------------------------------------------
27
+ // Default constructor
28
+ public TextBundle ( MainWindow win ) {
29
+ _win = win;
30
+ }
31
+
32
+ // -------------------------------------------------------------
33
+ // Imports a TextBundle of the given name.
34
+ public void import ( string filename ) {
35
+
36
+ var directory_path = filename;
37
+
38
+ try {
39
+
40
+ var directory = File . new_for_path( directory_path );
41
+ var enumerator = directory. enumerate_children( " standard::*" , FileQueryInfoFlags . NONE );
42
+
43
+ FileInfo ? info;
44
+ while ( (info = enumerator. next_file()) != null ) {
45
+ string name = info. get_name();
46
+ if ( info. get_file_type() == FileType . REGULAR ) {
47
+ if ( name. has_prefix( " test." ) && (name. has_suffix( " .markdown" ) || name. has_suffix( " .md" )) ) {
48
+ import_markdown( name );
49
+ }
50
+ }
51
+ }
52
+ enumerator. close();
53
+ } catch ( Error e ) {
54
+ stderr. printf(" Error: %s\n " , e. message);
55
+ }
56
+
57
+ }
58
+
59
+ private void import_markdown ( string filename ) {
60
+
61
+ // TODO
62
+
63
+ }
64
+
65
+ // =============================================================
66
+
67
+ // -------------------------------------------------------------
68
+ // Exports
69
+ public void export ( string filename ) {
70
+ // TODO
71
+ }
72
+
73
+ }
0 commit comments