OSDN Git Service

Ring 1.10 以来となる開発環境の日本語ローカライズ版 (評価版) を追加 (ノートパッド、フォームデザイナー、対話型実行環境、ファイルの検索)。
[ring-lang-081/ring.git] / applications / rnote / source / rnoterun.ring
diff --git a/applications/rnote/source/rnoterun.ring b/applications/rnote/source/rnoterun.ring
new file mode 100644 (file)
index 0000000..29a4a86
--- /dev/null
@@ -0,0 +1,92 @@
+# The Ring Notepad Application (RNote)
+# Author : Mahmoud Fayed <msfclipper@yahoo.com>
+
+Class RNoteRun
+
+       func DebugOperation cActiveFileName
+               cDir = CurrentDir()
+               chdir(exefolder())
+               cFileName = FileNameEncoding(cActiveFileName)
+               if isBatchFile(cFileName)
+                       cCode = RunBatchFile(cFileName)
+               else 
+                       if iswindows()
+                               cCode = 'start '+cCurrentDir+'batch\run "' + cFileName + '"' + nl
+                       else
+                               cCode = 'cd $(dirname "'+cFileName+'") ; ' + ' ring "' + cFileName + '"' + nl
+                       ok
+               ok
+               system(cCode)
+               chdir(cDir)
+
+       func RunOperation cActiveFileName
+               cDir = CurrentDir()
+               chdir(exefolder())
+               cFileName = FileNameEncoding(cActiveFileName)
+               if isBatchFile(cFileName)
+                       cCode = RunBatchFile(cFileName)         
+               else 
+                       if iswindows()
+                               cCode = 'start '+cCurrentDir+'batch\run2 "' + cFileName + '"' + nl
+                       else
+                               cCode = 'cd $(dirname "'+cFileName+'") ; ' + ' ring "' + cFileName + '"' + nl
+                       ok
+               ok
+               system(cCode)
+               chdir(cDir)
+
+       func RunGUIOperation cActiveFileName
+               oProcessEditbox.setplaintext("")
+               cDir = CurrentDir()
+               chdir(JustFilePath(cActiveFileName))
+               if isBatchFile(cActiveFileName)
+                       cCode = RunBatchFile(cActiveFileName)
+                       oProcess = RunProcess(cCode,"",cGetProcessData)
+               else 
+                       oProcess = RunProcess(cRingEXE,cActiveFileName,cGetProcessData)
+               ok
+               chdir(cDir)
+
+       func RunWebApplication cFile
+               cFileName = FileNameEncoding(cFile)
+               if isWindows() 
+                       if cWebApplicationFolder != JustFilePath(cFileName)
+                               cWebApplicationFolder = JustFilePath(cFileName)
+                               new ServerPrepare { 
+                                       setApplicationPath(this.cWebApplicationFolder)
+                                       PrepareConfigurationFile() 
+                                       cServerExe = getserverExeFile()
+                               }       
+                               oProcess = RunProcess(cCurrentDir + "batch\killwebserver.bat","",cGetProcessData)                       
+                               oProcess.waitForFinished(3000)
+                               oWebServerProcess = RunProcess(cServerEXE,"",cGetProcessData)                   
+                               sleep(3)
+                               oProcessEditbox.setplaintext("")
+                       ok
+                       new QDesktopServices {
+                               OpenURL(new qURL("http://localhost:8080/"+JustFileName(cFile)))
+                       }
+               else 
+                       cWebURL = cFileName
+                       nPos = substr(cWebURL,"htdocs")
+                       cWebURL = substr(cWebURL,nPOS+7)
+                       new QDesktopServices {
+                               OpenURL(new qURL("http://localhost/"+cWebURL))
+                       }
+               ok
+
+       func isBatchFile cFile 
+               if right(lower(trim(cFile)),4) = ".bat" or 
+                       right(lower(trim(cFile)),3) = ".sh"
+                       return True 
+               ok
+               return False 
+
+       func RunBatchFile cFile
+               if iswindows()
+                       chdir(JustFilePath(cFile))
+                       cCode = cFile
+               else
+                       cCode = 'cd $(dirname "'+cFile+'") ; ' + './' + cFile +  nl
+               ok
+               return cCode