Skip to content

Commit

Permalink
Add an option to change the transfer directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
Si13n7 committed Jul 5, 2018
1 parent c5cd7e1 commit ddba51c
Show file tree
Hide file tree
Showing 16 changed files with 390 additions and 52 deletions.
3 changes: 3 additions & 0 deletions src/AppsDownloader/AppsDownloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
<ItemGroup>
<None Include="Resources\Logo.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Logo164px.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down
3 changes: 3 additions & 0 deletions src/AppsDownloader/AppsDownloader64.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
<ItemGroup>
<None Include="Resources\Logo.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Logo164px.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down
57 changes: 50 additions & 7 deletions src/AppsDownloader/LangResources/de-DE.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 22 additions & 6 deletions src/AppsDownloader/LangResources/de-DE.resx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Dies könnte mit einem unvollständigen Download, oder einem anderen Netzwerkpro
<comment>Message</comment>
</data>
<data name="appListGroupBox" xml:space="preserve">
<value>App-Liste</value>
<value>Anwendungsliste</value>
<comment>GroupBox</comment>
</data>
<data name="appMenuItem1" xml:space="preserve">
Expand Down Expand Up @@ -354,12 +354,22 @@ Bitte stellen Sie sicher dass Ihre Einstellungen gespeichert sind, bevor Sie die
Bitte versuchen Sie es später noch einmal.</value>
<comment>Message</comment>
</data>
<data name="NotEnoughDiskSpaceMsg" xml:space="preserve">
<value>Nicht genügend Speicherplatz!
<data name="NotEnoughSpaceMsg" xml:space="preserve">
<value>Auf dem Speichergerät ({0}:\) ist nicht genügend freier Speicherplatz vorhanden.

Notwendig: {0}

Verfügbar: {1}</value>
Es muss mindestens {1} mehr Speicherplatz freigeben werden.</value>
<comment>Message</comment>
</data>
<data name="OperationCanceledMsg" xml:space="preserve">
<value>Der Vorgang wurde abgebrochen.</value>
<comment>Message</comment>
</data>
<data name="OperationCompletedMsg" xml:space="preserve">
<value>Der Vorgang wurde abgeschlossen.</value>
<comment>Message</comment>
</data>
<data name="OperationFailedMsg" xml:space="preserve">
<value>Der Vorgang ist fehlgeschlagen.</value>
<comment>Message</comment>
</data>
<data name="rememberLangCheck" xml:space="preserve">
Expand Down Expand Up @@ -398,6 +408,12 @@ Verfügbar: {1}</value>
<value>Datei: {0}/{1}</value>
<comment>Status</comment>
</data>
<data name="TransferDirDriveMsg" xml:space="preserve">
<value>Das benutzerdefinierte Übertragungsverzeichnis kann sich nicht auf demselben Speichergerät wie die Suite befinden.</value>
</data>
<data name="transferGroupBox" xml:space="preserve">
<value>Übertragungsverzeichnis</value>
</data>
<data name="urlStatusLabel" xml:space="preserve">
<value>Quelle:</value>
<comment>StatusLabel</comment>
Expand Down
57 changes: 50 additions & 7 deletions src/AppsDownloader/LangResources/en-US.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 22 additions & 6 deletions src/AppsDownloader/LangResources/en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ This could be due an incomplete download or other network issue.</value>
<comment>Message</comment>
</data>
<data name="appListGroupBox" xml:space="preserve">
<value>App List</value>
<value>Application List</value>
<comment>GroupBox</comment>
</data>
<data name="appMenuItem1" xml:space="preserve">
Expand Down Expand Up @@ -354,12 +354,22 @@ Please make sure your settings are saved before confirming this message!</value>
Please try again later.</value>
<comment>Message</comment>
</data>
<data name="NotEnoughDiskSpaceMsg" xml:space="preserve">
<value>Not enough disk space!
<data name="NotEnoughSpaceMsg" xml:space="preserve">
<value>There is not enough free space on the storage device ({0}:\).

Required: {0}

Available: {1}</value>
You must free up at least {1} more space.</value>
<comment>Message</comment>
</data>
<data name="OperationCanceledMsg" xml:space="preserve">
<value>Operation canceled.</value>
<comment>Message</comment>
</data>
<data name="OperationCompletedMsg" xml:space="preserve">
<value>Operation completed.</value>
<comment>Message</comment>
</data>
<data name="OperationFailedMsg" xml:space="preserve">
<value>Operation failed.</value>
<comment>Message</comment>
</data>
<data name="rememberLangCheck" xml:space="preserve">
Expand Down Expand Up @@ -398,6 +408,12 @@ Available: {1}</value>
<value>File: {0}/{1}</value>
<comment>Status</comment>
</data>
<data name="TransferDirMsg" xml:space="preserve">
<value>The custom transfer directory can not be on the same storage device as the suite.</value>
</data>
<data name="transferGroupBox" xml:space="preserve">
<value>Transfer Path</value>
</data>
<data name="urlStatusLabel" xml:space="preserve">
<value>Source:</value>
<comment>StatusLabel</comment>
Expand Down
3 changes: 2 additions & 1 deletion src/AppsDownloader/Libraries/AppSupply.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ internal static List<string> FindAppInstaller()
"*.zip",
"*.paf.exe"
};
appInstaller.AddRange(CorePaths.AppDirs.SelectMany(x => searchPattern.SelectMany(y => DirectoryEx.EnumerateFiles(x, y))));
if (Directory.Exists(Settings.TransferDir))
appInstaller.AddRange(searchPattern.SelectMany(x => DirectoryEx.EnumerateFiles(Settings.TransferDir, x)));
return appInstaller;
}

Expand Down
7 changes: 3 additions & 4 deletions src/AppsDownloader/Libraries/AppTransferor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ public AppTransferor(AppData appData)
{
if (DestPath == default(string))
{
if (!DirectoryEx.Create(Settings.TransferDir))
continue;
var fileName = Path.GetFileName(tuple.Item1);
if (string.IsNullOrEmpty(fileName))
continue;
DestPath = PathEx.Combine(AppData.InstallDir, "..");
if (DestPath.EndsWithEx("CommonFiles"))
DestPath = PathEx.Combine(DestPath, "..");
DestPath = PathEx.Combine(DestPath, fileName);
DestPath = PathEx.Combine(Settings.TransferDir, fileName);
}

var shortHost = tuple.Item1.GetShortHost();
Expand Down
19 changes: 15 additions & 4 deletions src/AppsDownloader/Libraries/CorePaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
internal static class CorePaths
{
private static string[] _appDirs;
private static string _appsDir, _appImages, _appImagesLarge, _appsLauncher, _appsSuiteUpdater, _archiver, _homeDir, _redirectUrl, _tempDir;
private static string _appsDir, _appImages, _appImagesLarge, _appsLauncher, _appsSuiteUpdater, _archiver, _homeDir, _redirectUrl, _tempDir, _transferDir;

internal static string AppsDir
{
Expand Down Expand Up @@ -86,9 +86,9 @@ internal static string FileArchiver
if (_archiver != default(string))
return _archiver;
#if x86
Compaction.SevenZipHelper.Location = Path.Combine(PathEx.LocalDir, "Helper\\7z");
Compaction.SevenZipHelper.Location = PathEx.Combine(PathEx.LocalDir, "Helper\\7z");
#else
Compaction.SevenZipHelper.Location = Path.Combine(PathEx.LocalDir, "Helper\\7z\\x64");
Compaction.SevenZipHelper.Location = PathEx.Combine(PathEx.LocalDir, "Helper\\7z\\x64");
#endif
_archiver = Compaction.SevenZipHelper.FilePath;
return _archiver;
Expand Down Expand Up @@ -131,9 +131,20 @@ internal static string TempDir
process.WaitForExit();
return _tempDir;
}
_tempDir = EnvironmentEx.GetVariableValue("TEMP");
_tempDir = Path.Combine(Path.GetTempPath(), "Port-Able");
DirectoryEx.Create(_tempDir);
return _tempDir;
}
}

internal static string TransferDir
{
get
{
if (_transferDir == default(string))
_transferDir = Path.Combine(TempDir, "Transfer");
return _transferDir;
}
}
}
}
Loading

0 comments on commit ddba51c

Please sign in to comment.