ear: Adding emear for Emscripten
authorJerome St-Louis <jerome@ecere.com>
Thu, 10 Mar 2016 16:59:17 +0000 (11:59 -0500)
committerJerome St-Louis <jerome@ecere.com>
Thu, 28 Jul 2016 22:23:11 +0000 (18:23 -0400)
- Packing all resources into resources.ear

ear/cmd/emEar.epj [new file with mode: 0644]
ear/cmd/emear.ec [new file with mode: 0644]

diff --git a/ear/cmd/emEar.epj b/ear/cmd/emEar.epj
new file mode 100644 (file)
index 0000000..d68d920
--- /dev/null
@@ -0,0 +1,41 @@
+{
+   "Version" : 0.2,
+   "ModuleName" : "emEar",
+   "Options" : {
+      "Warnings" : "All",
+      "TargetType" : "Executable",
+      "TargetFileName" : "emear",
+      "Libraries" : [
+         "ecere"
+      ],
+      "Console" : true
+   },
+   "Configurations" : [
+      {
+         "Name" : "Debug",
+         "Options" : {
+            "Debug" : true,
+            "Optimization" : "None",
+            "PreprocessorDefinitions" : [
+               "_DEBUG"
+            ],
+            "FastMath" : false
+         }
+      },
+      {
+         "Name" : "Release",
+         "Options" : {
+            "Debug" : false,
+            "Optimization" : "Speed",
+            "FastMath" : true
+         }
+      }
+   ],
+   "Files" : [
+      "emear.ec"
+   ],
+   "ResourcesPath" : "",
+   "Resources" : [
+
+   ]
+}
diff --git a/ear/cmd/emear.ec b/ear/cmd/emear.ec
new file mode 100644 (file)
index 0000000..c28baae
--- /dev/null
@@ -0,0 +1,37 @@
+import "ecere"
+
+class EarApp : Application
+{
+   void Main()
+   {
+      if(argc > 2)
+      {
+         const String s = argv[2];
+         if(SearchString(s, 0, ".html", false, true))
+         {
+            char f[MAX_LOCATION];
+            char command[16384];
+            int i;
+            // ChangeExtension(s, "earres", f);
+            StripLastDirectory(s, f);
+            PathCat(f, "resources.ear");
+
+            sprintf(command, "ear aw %s", f);
+            for(i = 3; i < argc; i++)
+            {
+               bool quote = false;
+               strcat(command, " ");
+               if(!argv[i][0] || strchr(argv[i], ' '))
+                  quote = true;
+               if(quote) strcat(command, "\"");
+               strcat(command, argv[i]);
+               if(quote) strcat(command, "\"");
+            }
+            {
+               DualPipe p = DualPipeOpen(0, command);
+               p.Wait();
+            }
+         }
+      }
+   }
+}