diff --git a/index.d.ts b/index.d.ts
index 95844fc..4239a49 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -26,7 +26,9 @@ declare namespace electronDl {
readonly saveAs?: boolean;
/**
- Directory to save the file in.
+ The directory to save the file in.
+
+ Must be an absolute path.
Default: [User's downloads directory](https://electronjs.org/docs/api/app/#appgetpathname)
*/
diff --git a/index.js b/index.js
index 700b5ea..3925b60 100644
--- a/index.js
+++ b/index.js
@@ -67,7 +67,12 @@ function registerListener(session, options, callback = () => {}) {
const window_ = majorElectronVersion() >= 12 ? BrowserWindow.fromWebContents(webContents) : getWindowFromWebContents(webContents);
+ if (options.directory && !path.isAbsolute(options.directory)) {
+ throw new Error('The `directory` option must be an absolute path');
+ }
+
const directory = options.directory || app.getPath('downloads');
+
let filePath;
if (options.filename) {
filePath = path.join(directory, options.filename);
diff --git a/index.test-d.ts b/index.test-d.ts
index 7821052..164ccfe 100644
--- a/index.test-d.ts
+++ b/index.test-d.ts
@@ -1,5 +1,3 @@
-///
-///
import {expectType} from 'tsd';
import {BrowserWindow, DownloadItem} from 'electron';
import electronDl = require('.');
diff --git a/readme.md b/readme.md
index 86f69ac..2d8af03 100644
--- a/readme.md
+++ b/readme.md
@@ -92,7 +92,9 @@ Note: Only use this option when strictly necessary. Downloading directly without
Type: `string`\
Default: [User's downloads directory](https://electronjs.org/docs/api/app/#appgetpathname)
-Directory to save the file in.
+The directory to save the file in.
+
+Must be an absolute path.
#### filename