1 line
4.5 KiB
Plaintext
1 line
4.5 KiB
Plaintext
|
{"version":3,"sources":["FileSystem.js"],"names":["async","dir","process","platform","await","osascript","openFinderToFolderAsync","spawnAsync","openFolderAsync","openFolderInTerminalAppAsync","child_process","exec","openConsoleAsync","path","Binaries","sourceBashLoginScriptsAsync","openInEditorAsync","env","EXPO_EDITOR","ErrorCode","PLATFORM_NOT_SUPPORTED","openFileInEditorAsync","openProjectInEditorAsync","openFolderName","openConsoleName","let","require"],"mappings":";;;;;;;;+BAgCOA,WAA+BC,GAA/BD,EAA4C;AACjD,QAAIE,QAAQC,QAARD,KAAqB,QAAzB,EAAmC;AACjC,aAAOE,MAAMC,UAAUC,uBAAVD,CAAkCJ,GAAlCI,CAAb;AACF,KAFA,MAEO,IAAIH,QAAQC,QAARD,KAAqB,OAAzB,EAAkC;AACvC,aAAOE,MAAMG,iDAAW,UAAXA,EAAuB,CAACN,GAAD,CAAvBM,CAAb;AACF;AACF,G;;kBANsBC,e;;;;;;gCAQfR,WAAgCC,GAAhCD,EAA6C;AAClD,QAAIE,QAAQC,QAARD,KAAqB,QAAzB,EAAmC;AACjC,aAAOE,MAAMC,UAAUI,4BAAVJ,CAAuCJ,GAAvCI,CAAb;AACF,KAFA,MAEO,IAAIH,QAAQC,QAARD,KAAqB,OAAzB,EAAkC;AACvCQ,6BAAcC,IAAdD,CAAoB,uBAAsBT,GAAI,GAA9CS;AACF;AACF,G;;kBANsBE,gB;;;;;;gCAQfZ,WAAqCa,IAArCb,EAAmD;AACxD,QAAIE,QAAQC,QAARD,KAAqB,QAAzB,EAAmC;AACjC;AACA;AACAE,YAAMU,gCAASC,2BAATD,EAANV;AACA,aAAOA,MAAMC,UAAUW,iBAAVX,CAA4BQ,IAA5BR,EAAkCH,QAAQe,GAARf,CAAYgB,WAA9Cb,CAAb;AACF,KALA,MAKO,IAAIH,QAAQC,QAARD,KAAqB,OAAzB,EAAkC;AACvC,YAAM,4CAAaiB,0CAAUC,sBAAvB,EAA+C,qCAA/C,CAAN;AACF;AACF,G;;kBATsBC,qB;;;;;;gCAWfrB,WAAwCC,GAAxCD,EAAqD;AAC1D,QAAIE,QAAQC,QAARD,KAAqB,QAAzB,EAAmC;AACjC;AACA;AACAE,YAAMU,gCAASC,2BAATD,EAANV;AACA,aAAOA,MAAMC,UAAUW,iBAAVX,CAA4BJ,GAA5BI,EAAiCH,QAAQe,GAARf,CAAYgB,WAA7Cb,CAAb;AACF,KALA,MAKO,IAAIH,QAAQC,QAARD,KAAqB,OAAzB,EAAkC;AACvC,YAAM,4CAAaiB,0CAAUC,sBAAvB,EAA+C,wCAA/C,CAAN;AACF;AACF,G;;kBATsBE,wB;;;;;QA3CNC,c,GAAAA,c;QAQAC,e,GAAAA,e;;AApBhB;;;;AACA;AAAA;AAAA;;;;AAEA;AAAA;AAAA;;;;AACA;AAAA;AAAA;;;;AACA;AAAA;AAAA;;;;;;;;AAEAC,IAAIpB,SAAJoB;AACA,IAAIvB,QAAQC,QAARD,KAAqB,QAAzB,EAAmC;AACjCG,cAAYqB,QAAQ,iBAARA,CAAZrB;AACF;;AAEO,SAASkB,cAAT,GAA0B;AAC/B,MAAIrB,QAAQC,QAARD,KAAqB,QAAzB,EAAmC;AACjC,WAAO,gBAAP;AACF,GAFA,MAEO,IAAIA,QAAQC,QAARD,KAAqB,OAAzB,EAAkC;AACvC,WAAO,uBAAP;AACF;AACF;;AAEO,SAASsB,eAAT,GAA2B;AAChC,MAAItB,QAAQC,QAARD,KAAqB,QAAzB,EAAmC;AACjC,WAAO,kBAAP;AACF,GAFA,MAEO,IAAIA,QAAQC,QAARD,KAAqB,OAAzB,EAAkC;AACvC,WAAO,aAAP;AACF;AACF","file":"../FileSystem.js","sourcesContent":["/**\n * @flow\n */\n\nimport child_process from 'child_process';\nimport spawnAsync from '@expo/spawn-async';\n\nimport * as Binaries from './Binaries';\nimport ErrorCode from './ErrorCode';\nimport XDLError from './XDLError';\n\nlet osascript;\nif (process.platform === 'darwin') {\n osascript = require('@expo/osascript');\n}\n\nexport function openFolderName() {\n if (process.platform === 'darwin') {\n return 'Show in Finder';\n } else if (process.platform === 'win32') {\n return 'Show in File Explorer';\n }\n}\n\nexport function openConsoleName() {\n if (process.platform === 'darwin') {\n return 'Open in Terminal';\n } else if (process.platform === 'win32') {\n return 'Open in Cmd';\n }\n}\n\nexport async function openFolderAsync(dir: string) {\n if (process.platform === 'darwin') {\n return await osascript.openFinderToFolderAsync(dir);\n } else if (process.platform === 'win32') {\n return await spawnAsync('explorer', [dir]);\n }\n}\n\nexport async function openConsoleAsync(dir: string) {\n if (process.platform === 'darwin') {\n return await osascript.openFolderInTerminalAppAsync(dir);\n } else if (process.platform === 'win32') {\n child_process.exec(`start cmd /K \"cd /d ${dir}\"`);\n }\n}\n\nexport async function openFileInEditorAsync(path: string) {\n if (process.platform === 'darwin') {\n // This will use the ENV var $EXPO_EDITOR if set, or else will try various\n // popular editors, looking for one that is open, or if none are, one that is installed\n await Binaries.sourceBashLoginScriptsAsync();\n return await osascript.openInEditorAsync(path, process.env.EXPO_EDITOR);\n } else if (process.platform === 'win32') {\n throw new XDLError(ErrorCode.PLATFORM_NOT_SUPPORTED, 'openFileInEditorAsync not supported');\n }\n}\n\nexport async function openProjectInEditorAsync(dir: string) {
|