You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

TestHelper.cs 622 B

5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122
  1. using System;
  2. using System.IO;
  3. namespace TensorFlowNET.UnitTest
  4. {
  5. public class TestHelper
  6. {
  7. public static string GetFullPathFromDataDir(string fileName)
  8. {
  9. var dataDir = GetRootContentDir(Directory.GetCurrentDirectory());
  10. return Path.Combine(dataDir, fileName);
  11. }
  12. static string GetRootContentDir(string dir)
  13. {
  14. var path = Path.GetFullPath(Path.Combine(dir, "data"));
  15. if (Directory.Exists(path))
  16. return path;
  17. return GetRootContentDir(Path.GetFullPath(Path.Combine(dir, "..")));
  18. }
  19. }
  20. }