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

Commit

Permalink
[#32] Fixes paths for Alfred 3
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashempel committed Aug 14, 2016
1 parent fd69173 commit 4ef7a2c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Binary file modified Google Translate.alfredworkflow
Binary file not shown.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
Google Translate Alfred Workflow
=============================

# Version 3.1.2
# Version 3.2.0

## Changelog

### 3.2.0

* Makes the workflow compatible to Alfred 2 and 3.

### 3.1.2

* This integrates a library to get Google results without the problem of running into the request limit (see https://github.com/Stichoza/google-translate-php). The only downside I see at the moment, is that the used API only returns one result and no alternatives. But I guess it's better than not working at all.


Expand Down
15 changes: 12 additions & 3 deletions src/workflows.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ function __construct( $bundleid=null )
$this->bundle = $bundleid;
endif;

$this->cache = $this->home. "/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/".$this->bundle;
$this->data = $this->home. "/Library/Application Support/Alfred 2/Workflow Data/".$this->bundle;
if (isset($_ENV['alfred_workflow_cache'])) {
$this->cache = $_ENV['alfred_workflow_cache'];
} else {
$this->cache = $this->home. "/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/".$this->bundle;
}

if (isset($_ENV['alfred_workflow_data'])) {
$this->data = $_ENV['alfred_workflow_data'];
} else {
$this->data = $this->home. "/Library/Application Support/Alfred 2/Workflow Data/".$this->bundle;
}

if ( !file_exists( $this->cache ) ):
exec("mkdir '".$this->cache."'");
Expand Down Expand Up @@ -480,4 +489,4 @@ public function result( $uid, $arg, $title, $sub, $icon, $valid='yes', $auto=nul
return $temp;
}

}
}

0 comments on commit 4ef7a2c

Please # to comment.