From d240f9bc4532b0ba9a0b24786b36b4d59f8a4d98 Mon Sep 17 00:00:00 2001 From: youxiachai Date: Wed, 22 Jan 2014 10:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E4=BA=AB=E6=A8=A1=E5=9D=97=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=94=AF=E6=8C=81windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题相关 #30 --- libs/fm.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libs/fm.js b/libs/fm.js index 9b93978..62d14fa 100644 --- a/libs/fm.js +++ b/libs/fm.js @@ -28,7 +28,8 @@ var fs = require('fs'), sys = require('../package'), sdk = require('./sdk'), utils = require('./utils'), - errors = require('./errors'); + errors = require('./errors'), + openBrowser = process.platform === 'win32' ? 'start' : 'open'; var shorthands = { 'return': 'play', @@ -222,7 +223,7 @@ Fm.prototype.go = function(channel, user, link) { if (!this.player) return false; if (!this.player.playing) return false; return exeq([ - 'open ' + (link ? link : this.album(this.player.playing.album)) + openBrowser + ' ' + (link ? link : this.album(this.player.playing.album)) ]).run(); } @@ -231,8 +232,8 @@ Fm.prototype.share = function(channel, user) { if (!this.player.playing) return false; var self = this; var song = self.player.playing; - return self.go(null, null, - 'http://service.weibo.com/share/share.php?' + + + var shareText = 'http://service.weibo.com/share/share.php?' + '&type=button' + '&style=number' + '&appkey=5rjNpN' + @@ -257,8 +258,14 @@ Fm.prototype.share = function(channel, user) { song.public_time, self.album(song.album) ].join(' ') - ) - ); + ); + + if(process.platform === 'win32'){ + //win 下终端 & 需要转义 + shareText = shareText.replace(/&/g, '^&'); + } + + return self.go(null, null, shareText); } Fm.prototype.createMenu = function(callback) {