Skip to content

Commit 5d91767

Browse files
committed
add blobpath parameter
1 parent 94acbbd commit 5d91767

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/org/citybot/ant/AzureBlobFileUpload.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class AzureBlobFileUpload extends Task {
2828
String container;
2929
String account;
3030
String key;
31+
String blobPath;
3132
String protocol = "http";
3233
private Vector filesets = new Vector();
3334
Boolean create = true;
@@ -54,6 +55,14 @@ public void setList(Boolean list) {
5455
public void addFileset(FileSet fileset) {
5556
filesets.add(fileset);
5657
}
58+
59+
public String getBlobPath() {
60+
return blobPath;
61+
}
62+
public void setBlobPath(String blobPath) {
63+
this.blobPath = blobPath;
64+
}
65+
5766
public void execute() {
5867
if (container==null) {
5968
throw new BuildException("Property 'container' is required");
@@ -67,6 +76,10 @@ public void execute() {
6776
if(filesets.isEmpty()) {
6877
throw new BuildException("A nested 'fileset' is required");
6978
}
79+
if (blobPath==null) {
80+
blobPath = "";
81+
}
82+
7083
try {
7184
String storageConnectionString = String.format("DefaultEndpointsProtocol=%s;AccountName=%s;AccountKey=%s", protocol, account, key);
7285
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
@@ -92,6 +105,9 @@ public void execute() {
92105
String filename = includedFiles[i].replace('\\','/');
93106
File source = new File(ds.getBasedir() + "/" + filename);
94107
String blobname = filename.substring(filename.lastIndexOf("/")+1);
108+
if(blobPath!=null){
109+
blobname = blobPath + File.pathSeparator + blobname;
110+
}
95111
CloudBlockBlob blobHandle = blobContainer.getBlockBlobReference(blobname);
96112
blobHandle.upload(new FileInputStream(source), source.length());
97113
}

0 commit comments

Comments
 (0)