51 void loadPrimitives() { |
51 void loadPrimitives() { |
52 print ("Loading primitives...\n"); |
52 print ("Loading primitives...\n"); |
53 loadPrimitiveCatgories(); |
53 loadPrimitiveCatgories(); |
54 |
54 |
55 // Try to load prims.cfg |
55 // Try to load prims.cfg |
56 File conf (config::filepath ("prims.cfg"), File::Read); |
56 File conf (Config::filepath ("prims.cfg"), File::Read); |
57 |
57 |
58 if (!conf) { |
58 if (!conf) { |
59 // No prims.cfg, build it |
59 // No prims.cfg, build it |
60 PrimitiveLister::start(); |
60 PrimitiveLister::start(); |
61 } else { |
61 } else { |
128 m_prims << info; |
128 m_prims << info; |
129 emit update (++i); |
129 emit update (++i); |
130 } |
130 } |
131 |
131 |
132 // Save to a config file |
132 // Save to a config file |
133 File conf (config::filepath ("prims.cfg"), File::Write); |
133 File conf (Config::filepath ("prims.cfg"), File::Write); |
134 |
134 |
135 for (Primitive & info : m_prims) |
135 for (Primitive & info : m_prims) |
136 fprint (conf, "%1 %2\n", info.name, info.title); |
136 fprint (conf, "%1 %2\n", info.name, info.title); |
137 |
137 |
138 conf.close(); |
138 conf.close(); |
229 |
229 |
230 // ============================================================================= |
230 // ============================================================================= |
231 // ----------------------------------------------------------------------------- |
231 // ----------------------------------------------------------------------------- |
232 static void loadPrimitiveCatgories() { |
232 static void loadPrimitiveCatgories() { |
233 g_PrimitiveCategories.clear(); |
233 g_PrimitiveCategories.clear(); |
234 File f (config::dirpath() + "primregexps.cfg", File::Read); |
234 File f (Config::dirpath() + "primregexps.cfg", File::Read); |
235 |
235 |
236 if (!f) |
236 if (!f) |
237 f.open (":/data/primitive-categories.cfg", File::Read); |
237 f.open (":/data/primitive-categories.cfg", File::Read); |
238 |
238 |
239 if (!f) |
239 if (!f) |