adb: fix stat on Windows.

stat on Windows fails with ENOENT when passed a path with a trailing
slash or backslash, regardless of whether the target is actually a
directory. Emulate the correct POSIX behavior by stripping trailing
path separators and then checking if the target is a directory if
successful.

Bug: http://b/30481559
Bug: https://code.google.com/p/android/issues/detail?id=214633
Change-Id: I1d398d19a9bce1ecb3fdc4aabc31aa98c82c3f93
Test: Relevant adb_tests pass on Linux and Windows 10.
(cherry picked from commit f551ea0f6309465eeab70404076bd881320f4883)
diff --git a/adb/Android.mk b/adb/Android.mk
index 695cbe0..8f56d74 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -62,6 +62,7 @@
     fdevent_test.cpp \
     socket_test.cpp \
     sysdeps_test.cpp \
+    sysdeps/stat_test.cpp \
     transport_test.cpp \
 
 LIBADB_CFLAGS := \
@@ -89,6 +90,7 @@
 
 LIBADB_windows_SRC_FILES := \
     sysdeps_win32.cpp \
+    sysdeps/win32/stat.cpp \
     usb_windows.cpp \
 
 LIBADB_TEST_windows_SRCS := \