File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ const disableMessage = 'Gradient ' + disableName + 'd. ' + enableCommonMessage
4747 * @returns
4848 */
4949function getResetContent ( ) {
50+ if ( ! fs . existsSync ( htmlFile ) ) {
51+ showMessage ( 'Gradient Theme is not supported on this platform.' )
52+ return ''
53+ }
54+
5055 const html = fs . readFileSync ( htmlFile , 'utf-8' )
5156 const regex = new RegExp (
5257 `<style[^>]*${ config . tagAttr } [^>]*>.*?</style>|<script[^>]*${ config . tagAttr } [^>]*>.*?</script>` ,
@@ -60,6 +65,11 @@ function getResetContent() {
6065 * 重置html文件,用于删除所有插件插入的style和script
6166 */
6267function reset ( ) {
68+ if ( ! fs . existsSync ( htmlFile ) ) {
69+ showMessage ( 'Gradient Theme is not supported on this platform.' )
70+ return ''
71+ }
72+
6373 const output = getResetContent ( )
6474 fs . writeFileSync ( htmlFile , output , 'utf-8' )
6575}
@@ -68,6 +78,11 @@ function reset() {
6878 * enable命令后,启动主题样式插入逻辑
6979 */
7080function install ( ) {
81+ if ( ! fs . existsSync ( htmlFile ) ) {
82+ showMessage ( 'Gradient Theme is not supported on this platform.' )
83+ return ''
84+ }
85+
7186 const themeConfig = vscode . workspace . getConfiguration ( 'gradientTheme' )
7287 const css = themeConfig ? themeConfig . css : [ ]
7388 const customCssOutHtml = css
You can’t perform that action at this time.
0 commit comments