Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
used path.join to make it more cross-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Mar 4, 2012
1 parent b5fb4bf commit 05c2ba3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions example/download.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
youtubedl = require('..');
var ytdl = require('..');


dl = youtubedl.download('http://www.youtube.com/watch?v=90AiXO1pAiA',
dl = ytdl.download('http://www.youtube.com/watch?v=90AiXO1pAiA',
__dirname,
// optional arguments passed to youtube-dl
['--max-quality=18']);
Expand Down
4 changes: 2 additions & 2 deletions example/info.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
youtube = require('..');
var ytdl = require('..');

youtube.info('http://www.youtube.com/watch?v=WKsjaOqDXgg',
ytdl.info('http://www.youtube.com/watch?v=WKsjaOqDXgg',

// called when video page is downloaded and info extracted
function(err, info) {
Expand Down
6 changes: 2 additions & 4 deletions lib/youtube-dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var parseOpts = function(args) {
};

// check that youtube-dl file exists
var file = path.normalize(__dirname + '/../bin/youtube-dl');
var file = path.join(__dirname, '..', 'bin', 'youtube-dl');
path.exists(file, function(exists) {
if (exists) return;

Expand Down Expand Up @@ -117,9 +117,7 @@ var regex = /(\d+\.\d)% of (\d+\.\d+\w) at\s+([^\s]+) ETA ((\d|-)+:(\d|-)+)/;
// main download function
exports.download = function(url, dest, args) {
// setup settings
if (dest == null) {
dest = './';
}
dest = dest || process.cwd();
if (args == null) {
args = [];
} else {
Expand Down
2 changes: 1 addition & 1 deletion scripts/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var fs = require('fs')
, exec = require('child_process').exec


var folder = path.normalize(__dirname + '/../bin')
var folder = path.join(__dirname, '..', 'bin')
, filename = '/youtube-dl'
, filepath = folder + filename

Expand Down
14 changes: 7 additions & 7 deletions test/download.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var vows = require('vows')
ytdl = require('..'),
fs = require('fs'),
path = require('path'),
assert = require('assert'),
video = 'http://www.youtube.com/watch?v=90AiXO1pAiA';
var vows = require('vows')
, ytdl = require('..')
, fs = require('fs')
, path = require('path')
, assert = require('assert')
, video = 'http://www.youtube.com/watch?v=90AiXO1pAiA'


vows.describe('download').addBatch({
Expand Down Expand Up @@ -35,7 +35,7 @@ vows.describe('download').addBatch({

'file was downloaded': function(err, data) {
// check existance
var filepath = __dirname + '/' + data.filename;
var filepath = path.join(__dirname, data.filename);
assert.isTrue(path.existsSync(filepath));

// delete file after each test
Expand Down
8 changes: 4 additions & 4 deletions test/info.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var vows = require('vows')
ytdl = require('./../lib/youtube-dl'),
assert = require('assert'),
video = 'http://www.youtube.com/watch?v=90AiXO1pAiA';
var vows = require('vows')
, ytdl = require('..')
, assert = require('assert')
, video = 'http://www.youtube.com/watch?v=90AiXO1pAiA'


vows.describe('info').addBatch({
Expand Down

0 comments on commit 05c2ba3

Please sign in to comment.